PDA

View Full Version : TextArea Scroll to Top



DirtDog
1 Jun 2009, 4:43 AM
I did the usual search for an answer but didn't find any.

I want to scroll to the top of a Ext.form.TextArea.

How do I do this?

Ed

Animal
1 Jun 2009, 4:44 AM
Same was as you always scroll scrollable elements to the top in all the HTML pages you've ever written.

Set the scrollTop of the HtmlElement to 0

DirtDog
1 Jun 2009, 8:25 AM
I tried your suggestion. No go. The scroll bar stays at the bottom.

I have several cards in a card layout.

I switch to the form with the TextArea, scroll to the bottom, then switch to another form
in the card layout, then switch back to the form with the TextArea.

Right before calling setActiveItem to switch to the form with the TextArea I call load on a Store, the Store Load event calls:

function CLP_AccountLettersStoreLoad(StoreObj, Records, Options)
{
if (Records.length == 0) return;
var FormObj = WindowObj.findById('AccountLettersForm');
FormObj.getForm().loadRecord(Records[0]);
CLP_AccountLettersScrollTop();
}

function CLP_AccountLettersScrollTop()
{
var FormObj = WindowObj.findById('AccountLettersForm');
var LetterObj = FormObj.findById('Letter');
LetterObj.getEl().scrollTop = 0;
FormObj.doLayout();
}

Animal
1 Jun 2009, 9:36 AM
getEl.

What does it return?

DirtDog
1 Jun 2009, 11:09 AM
Got it. Works.

Thanks,

Ed