PDA

View Full Version : How to maintain to scroll position in Ext.ux.grid.LockingGridView



prabhukm
21 May 2010, 10:40 AM
I'm having a Grid with more than 20 columns. And I'm using LockingColumnModel & LockGridView to lock couple of columns. In order to maintain the Scroll Position, I added the listeners on viewConfig. But it didn't worked. When I looked at the GridPanel document, for viewConfig it says 'This option is ignored if view is specified.'

So how can I maintain the Scroll Position?



this.gridPanel = new Ext.grid.GridPanel({
store : this.getDataStore( this.type )
, title : this.title
, region : "center"
, height : 'auto'
, cm : new Ext.ux.grid.LockingColumnModel(Iq.common.createHeaderArray( this.getRecordType(this.type), null, null ))
, border : true
, margin: '5 5 5 5'
//, enableColumnHide: false
,listeners : {
'rowcontextmenu' : this.showContextMenuAction,
'rowclick' : this.maintainRowSelection,
'scope' : this
}
, viewConfig: {
onLoad: Ext.emptyFn,
listeners: {
beforerefresh: function(v)
{
v.scrollTop = v.scroller.dom.scrollTop;
v.scrollHeight = v.scroller.dom.scrollHeight;
v.scrollLeft = v.scroller.dom.scrollLeft;
v.scrollWidth = v.scroller.dom.scrollWidth;
},
refresh: function(v)
{
v.scroller.dom.scrollTop = v.scrollTop +
(v.scrollTop == 0 ? 0 : v.scroller.dom.scrollHeight - v.scrollHeight);
v.scroller.dom.scrollLeft = v.scrollLeft +
(v.scrollLeft == 0 ? 0 : v.scroller.dom.scrollWidth - v.scrollWidth);
}
}
}
, view: new Ext.ux.grid.LockingGridView({
enableRowBody:false,
showPreview:false,
syncHeights: true,
stripeRows: true,
autoScroll:true
})
});