我有一个编码条件,我需要有多个 ExtJS 文本区域。在输入时,我需要它们具有一定的大小。即增长:假。
像这样:
me.outputDataPanel = Ext.create('Ext.panel.Panel', {
bodyStyle : me.htmlBodyStyle,
cls : 'htmlView_font',
border: 0,
style: 'margin: 20px 20px 20px 20px;'
});
var textField = Ext.create('Ext.form.field.TextArea', {
enforceMaxLength: true,
maxLength: 5000,
grow: false,
fieldStyle: {
'fontFamily': me.textFont,
'fontSize': '16px'
},
style: 'padding-top: 10px ; padding-bottom: 30px;',
width: '94%'
});
me.outputDataPanel.insert(me.itemIndex, textField);
me.itemIndex+=me.itemIndex;
现在我有一个按钮,单击该按钮每个文本框都应自行调整大小以显示框中的全部内容。即,动态地使其增长:是的。我怎样才能做到这一点?
请帮忙!
最佳答案
您可以使用 autoSize()
方法。
Automatically grows the field to accomodate the height of the text up to the maximum field height allowed. This only takes effect if grow = true, and fires the autosize event if the height changes.
关于javascript - 使 ExtJS 文本区域随 grow : true but only with click of a button 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34454090/