javascript - Ext JS - 如何滚动到文本区域的底部

标签 javascript extjs extjs3

下面是我的代码。如何滚动到文本区域的底部? 一定是这样的

Ext.getCmp('output').setScrollPosition(Ext.getCmp('output').getScrollHeight());

这是我的文本区域代码:

var myWin= new Ext.Window({
            height        :    340,
            title        :    'CHAT',
            modal        :    true,
            resizable    :    false,
            draggable    :    false,
            closable     :    false,
            width        :    477,
            layout       : 'absolute',
            bodyStyle    :    'padding : 10px',
            buttonAlign  : 'center',
            items        :    [
            {
                id           :    'output',
                xtype        :    'textarea',
                width        :    216,
                readOnly     :    true,
                autoScroll   :    true,
                height       :    234,
                x            :    10,
                y            :    10
            },
            item6,
            {
                id       :    'input',
                xtype    :    'textfield',
                width    :    443,
                y        :    249,
                x        :    10
            }]

...

最佳答案

我认为没有 ExtJs 方法来滚动文本区域,但是您可以使用 HTML 文本区域属性:

var t = Ext.getCmp('output'),
   t1 = t.getEl().down('textarea');
t1.dom.scrollTop = 99999;

这是讨论的问题:Dynamically Scrolling a Textarea

关于javascript - Ext JS - 如何滚动到文本区域的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10964667/

相关文章:

javascript - React ImmutableJS - ShouldComponentUpdate

javascript - 在 Internet Explorer 中获取元素时遇到问题 - 适用于 Chrome、Firefox

javascript - 如何在网格上使用过滤器(空记录除外)(ExtJS 6.5.3)

javascript - 为什么 Ext flash 组件连接两个字符串来形成这个 url?

gridview - extjs 分组网格的组头复选框

javascript - URL 作为查询字符串中的值应该编码多少次?

javascript - jQuery-验证使用时间选择器选择的开始时间和结束时间

javascript - 如何将简单的 dom 元素添加到 ExtJS 容器中?

javascript - 工具栏中不显示单选组按钮

user-interface - ExtJS 3.x 和 ExtJS 5 可以在单个应用程序中共存吗?