View Full Version : GridView refresh event not firing properly

7 Sep 2010, 4:38 PM
Hello everyone

Hope someone can help me with this problem. I have created a locking grid and the effect I want to achieve is to have the grid scroll to the right when it refreshes. However, the refresh event seems to be triggered too early...it always reset the scrollbar back to the left after the refresh happens. Is there a way to override this behaviour?

My grid creation code looks like this:

grid = new Ext.grid.GridPanel({
store: store,
colModel: new Ext.ux.grid.LockingColumnModel(columns),
enableColumnResize: false,
enableColumnMove: false,
enableColumnHide: false,
enableHdMenu: false,
selModel: new Ext.grid.RowSelectionModel({ singleSelect: true }),
view: new Ext.ux.grid.LockingGridView()

and my event handler is like this

grid.getView().on("refresh", function (v) { v.scroller.dom.scrollLeft = 10000; });

I can get it to work with a little trick, by delaying this function by about 1 sec...

grid.getView().on("refresh", function (v) { setTimeout(function () { v.scroller.dom.scrollLeft = 10000; }, 1000); });

but its not an elegant solution and don't know if it will work on all browsers and the 1 sec delay is noticeable though bearable.

Any help would be greatly appreciated.


8 Sep 2010, 12:05 AM

view: new Ext.ux.grid.LockingGridView({
scrollToTop: Ext.emptyFn

9 Sep 2010, 4:01 PM

view: new Ext.ux.grid.LockingGridView({
scrollToTop: Ext.emptyFn

Cool! works like a charm! Thanks Condor.