javascript - 使 ExtJS 文本区域随 grow : true but only with click of a button 扩展

标签 javascript html css extjs

我有一个编码条件,我需要有多个 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.

工作示例:https://fiddle.sencha.com/#fiddle/131r

关于javascript - 使 ExtJS 文本区域随 grow : true but only with click of a button 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34454090/

相关文章:

javascript - CSS 图片库 - 响应式中心对齐

html - 如何解决介绍页高度

javascript - 作为汽车配置器控制复杂的 Sprite 图像

Javascript Linksys 路由器样式日志弹出窗口

javascript - 如何使用 ExtJS 设置样式

c# - 非mshtml c#解析html和javascript

html - <fieldset> 在 html 中的宽度

html - 从超链接图像中删除下划线

javascript - 拒绝数字序列的正则表达式,例如 "1234"

CSS Transition 在 :hover exit 上发送 Div 下面的内容