PDA

View Full Version : [SOLVED] scroll to selected row in EditorGridPanel



shahdollie
23 Nov 2010, 6:47 PM
hi everyone...

I am using EditorGridPanel. I want to scroll to the selected row in my grid (in firefox and IE + all other browsers). I tried following (but didn't work):



'load': function(store, records, objOptions) {
grid.getView().focusRow(24);
}
Then i tried following:



store.loadData(newdata);
store.commitChanges();

// try -1
grid.getView().focusRow(24);

// try -2
grid.getView().ensureVisible(24,0,true);

// try -3 (worked in IE but not in Firefox)
var view = grid.getView();
var rowEl = Ext.get( view.getRow(24) );
rowEl.scrollIntoView(view.scroller);

// try - 4
var gridEl = grid.getGridEl();
var rowEl = grid.getView().getRow(24);
rowEl.scrollIntoView(gridEl,false);
Any clue to what am I doing wrong????
How to do this?
Thanks a lot for help
Regards

Condor
24 Nov 2010, 12:46 AM
Your first solution should work (as long as you've configured the grid with deferRowRender:false).

shahdollie
24 Nov 2010, 2:36 PM
Hi Condor thanks for replying. I got it what the problem is.

Actually there was a problem:
when i first click on grid (eg. row 30), it will scroll to top so to fix this I used following:



Ext.grid.GridView.override({
syncFocus : false
})


I used my first method:


'load': function(store, records, objOptions) {
grid.getView().focusRow(24);
// Breakpoint-A
}


Firefox 3.6.8: When I use breakpoint, row is focused but when i remove breakpoint and repeat the process then grid will scroll to top

Chrome 7.0.517.44 & Safari 5.0.2 & Opera 10.63 : My grid is in tabpanel so when i m in tab1 and try to focus row then it won't be focussed when i change the tab AFTER grid is loaded but it will be focussed when i change the tab BEFORE grid is loaded or loading .If i m in grid's tab then it will be focussed.

IE: Last row seen is row 23 (i focused 24th row)

Any way to solve this ?

Regards

joehebe
8 Dec 2010, 6:39 PM
Thanks a lots.
deferRowRender should be added to Extjs3.3 Api doc.

Condor
8 Dec 2010, 11:45 PM
deferRowRender should be added to Extjs3.3 Api doc.

Care to make a report in the Bugs section about this?

shahdollie
9 Dec 2010, 2:00 PM
Well i m not sure what is causing this but when I removed following code, focusRow() worked fine:



Ext.grid.GridView.override({
syncFocus : false
})


I dont know what is this code used for...I mean i dont know why this was used (as it was long time ago) so i really hope it doesn't break anything else

Regards

Condor
9 Dec 2010, 11:53 PM
GridView doesn't have a syncFocus property, so this does nothing.