View Full Version : Controlling the scroll position in an Ext.form.TextArea

6 May 2010, 7:36 AM
I have an Ext.form.TextArea I'm using for a chat window, and I'm appending text to the bottom of it. When I do, it ends up scrolling back to the top. Is there any way to get around this behaviour?

6 May 2010, 6:49 PM
have you tried scrollTop of the textarea alement?

12 Apr 2011, 7:47 AM
I'm also trying to do this and can't seem to get my hands on the right part of the dom (still new to extjs)

I've tried variations of the following (using 2000 just to test since I'm having so many issues)

var txtConsole = multi_form.getForm().findField('multi_urls');
txtConsole.setScrollTop (2000); //didn't work
txtConsole.getEl().setScrollTop(2000); //didn't work
txtConsole.ScrollTop = 2000;//didn't work
var txtConsole = Ext.get('multi_urls');
txtConsole.setScrollTop(2000); //didn't work
txtConsole.ScrollTop = 2000; //didn't work
txtConsole.getEl().setScrollTop(2000); //didn't work
txtConsole.getElement().getFirtChildElement().setScrollTop( txtConsole.getElement().getFirtChildElement().getScrollHeight() ); //saw this on another post, didn't work

I know I'm somewhere in the right area but can't seem to put the two things together!

FINALLY got the correct combination working:

Took me a bit to get to the right dom object and use the correct scroll method.

(My textarea's id is multi_urls)

Ext.getCmp('multi_urls').getEl().scroll('bottom', Ext.getCmp('multi_urls').getValue().length);

Seems to be working. Not sure if


is the proper number to scroll down to, but that can be adjusted with more research if it's not correct