簡體   English   中英

Ext JS - 如何滾動到Textarea的底部

[英]Ext JS - How to Scroll to bottom of Textarea

這是我的代碼。 如何滾動到textarea的底部? 它一定是這樣的

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

這是我的textarea代碼:

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
            }]

...

我不認為有滾動textarea的ExtJs方法,但是你可以使用HTML textarea屬性:

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

以下是討論它的問題: 動態滾動Textarea

var d = Ext.getCmp('output').getEl().down('textarea').dom;
d.scrollTop = d.scrollHeight - d.offsetHeight;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM