Reputation: 6466
I need to scroll to a form field (a displayfield
actually) automatically. Since the field is dynamic, sometimes it is already shown in the rendered area of page, sometimes it is not.
How can I do this using ExtJS 4.x
?
Upvotes: 2
Views: 2702
Reputation: 4089
Use focus()
on the desired displayfield
:
<yourDisplayField>.focus();
Upvotes: 1
Reputation: 14591
Use scrollTo
function of Ext dom element. Reference
scrollTo( side, value, [animate] ) -> Scrolls this element the specified scroll point.
Parameters
Add following lines of code to the form panel.
listeners:{
afterrender: function(){
this.body.el.scrollTo('top',200,true);
}
},
Upvotes: 0