If grid order by column the show row doesn't work


I use buttons to scroll mygrid.
If I use the grid.sortRows(col, type, order); function the showrow doesn’t scroll into view.
I use it like:

var state=mygrid.getStateOfView(); target=Math.round(state[0]/2.5); target=target+3+Math.round(state[1]/2.5); if (target<state[2]){ mygrid.showRow(target); }else{ mygrid.showRow(state[2]); }
I use the it like this because if I set style, the getstateofview use the default row height :frowning:

getStateOfView() working with the indexes of the rows but showRow() is with the id.
Please, try to get the just the id or the index of the row.
To get the id/index you may use:

var rowID=mygrid.getRowId(ind);// get the id of the row from the index var rowIndex=mygrid.getRowIndex(id); //get the index of the row from it's id

Thx sematik I will try it but the getstateofview state[1] get 16 visible row, but I only have 7 after I set the gridstyle. Why?

I wrote a little demo my other topic: scroll mygrid up down with buttons
please see it!

Hello sematik!

I tied what you suggested but this command:


doesn’t scroll on the end of grid. It stops before two row of end.

mygrid.getStateOfView()[2] (paging mode off) returns the number of the rows. But the indexes are zero-based.
If you have 16 rows the index of the last one will be 15.

Please, try to use