PDA

View Full Version : Reposition scrollbar in the center region of a border panel



caly
27 May 2010, 1:47 PM
I have a GUI look like the following:

20684


All the components are created the very first time when the hosting JSP is loaded. The data will be loaded after that. There is no component re-drawn when any data is being loaded.

When a row in the grid is clicked, some data will be loaded in the forms residing in the center region of the border panel. The scroll-bar in the center region is moved down to view data. When another row is clicked, the scroll-bar stays at the same position.

My question is: how to reposition the scroll-bar to the top of the center region?

This is the code for the border panel.



var panel = new Ext.Panel({
id: _id,
layout: 'border',
border: false,
height: pHeight,
items: [{region: 'north', id: 'northRegion', height: 36, items: [ northPanel ] },
{region: 'center', id: 'centerRegion', autoScroll: 'y', items: [ centerPanel ] }
]
});



When I debug the script, regardless where the scrollbar is, the value of the following properties are 0:

Ext.getCmp('centerRegion').getEl().dom.scrollTop
Ext.getCmp('centerRegion').getEl().dom.scrollLeft


Thank you.