PDA

View Full Version : Which event to use for performing scrolling to a particular row of grid store load?



ashu2289
14 Nov 2012, 2:17 AM
As 'viewready' event is suggested for performing the selection of a default row. I want an event where i can bring the focus to selected row as well.
Let's say, on grid store load we want to select a row with index as 'rowIndex',


grid.getSelectionModel().select(rowIndex);
grid.getView().focusRow(recordID);

and bring focus to that row as well. 'Viewready' event can ensure for making selection but how can i ensure that my grid is ready to perform scrolling as well?

tvanzoelen
14 Nov 2012, 2:51 AM
I saw this problem earlier, but I don't understand why it seems not to work in the stores load event. It works for me.

The only difference I see is that I give the record as inputparam in the focusRow instead of the id.

ashu2289
14 Nov 2012, 3:50 AM
Might be because on store load i am also expanding the records. Which leads to scroller refresh and when i am focusing on that row my scroller does not lead me to that because its not ready at that moment.
If i add a delay of 1 second to focusRow function, it works fine.
I am just predicting a cause.

tvanzoelen
14 Nov 2012, 3:52 AM
Do you use a groupedgrid or a rowexpander feature?

ashu2289
14 Nov 2012, 4:57 AM
rowexpander

tvanzoelen
14 Nov 2012, 5:03 AM
If you expand it after load you could listen to the expandbody( rowNode, record, expandRow, eOpts ) event on the rowexpander. And then focus it.

ashu2289
14 Nov 2012, 5:24 AM
I will give it a try. Although even if I stopped expanding the rows of the grid, focusRow does not work in my case.

ashu2289
14 Nov 2012, 7:01 AM
FocusRow/Scrolling is working in case when i am traversing through pages using pagination toolbar. Looking further in to it. Used store load event as of now.