Reputation: 4260
I used com.extjs.gxt.ui.client.widget.form.TextArea
txtConsole= new TextArea();
txtConsole.setReadOnly(true);
container.add(txtConsole);
and setting its value and trying to set scroll to bottom;
txtConsole.setValue(message);
txtConsole.setCursorPos(message.length());
txtConsole.getElement().setScrollTop(txtConsole.getElement().getScrollHeight());
But scroll is still at the top of the textarea. I am using GWT 2.1 and GXT 2.2.1.
What should I do to send scroll to bottom?
Thanks.
Upvotes: 1
Views: 2269
Reputation: 4260
I've found the solution and it works
txtConsole.getElement().getFirstChildElement().setScrollTop(txtConsole.getElement().getFirstChildElement().getScrollHeight())
According to below description;
Need to get the element after rendering. getElement() before rendering will return a dummy element. Also getElement returns the wrong one. It will be getElement().getFirstChildElement();
Upvotes: 2