Page Then Select First Row

I simply want to auto select the very first visible row when changing pages in my grid. Here is the code I have in place…

myGrid.attachEvent("onPageChanged", function(ind,fInd,lInd){

And this works fine so long as the page was already loaded ahead of time. But when it has to go out and fetch the data this does not work. I tried putting the selectRow in the onXLE event but that only fires when it goes out to fetch new grid data. How do I solve this? Do I have to put a setTimeout in the onPageChanged event? I hate doing things that way as it seems like a hack and you can never be sure it’ll work as expected cause of network delays.

Never mind, I figured it out. I had to use a combination of onPageChanged and onXLE. Basically,

mygrid.attachEvent(“onPageChanged”, function(ind,fInd,lInd){ mygrid.selectRow(fInd,true); });

mygrid.attachEvent(“onXLE”, function(grid_obj,count){ state=mygrid.getStateOfView(); mygrid.selectRow(state[1],true); });

How i will autoSelect the first row when am displaying myGrid?

Please, try to call the selectRow() method after the data is loaded to the grid completely.
You should use the callback function of the load() method: