How can I trigger selecting first row in a grid?


How can I trigger onRowSelect event to select the first row in a grid, when I’m selecting a particular tab?

I have onSelect event for tab

tabbar.attachEvent("onSelect", function(id,last_id){ // code return true; });

and inside to select somehow the first row. The event for selecting a row with the mouse is:

gridAntenna.attachEvent("onRowSelect", function(id,ind) { }

Can you give me some hints, please?

Please, try to use the following code:

tabbar.attachEvent("onSelect", function(id,last_id){ gridAntenna.selectRow(0); return true; });
Note: Please make sure that necessary row is loaded before calling this method.

How can I find the id of the first row?

If I want to select first row, I’m doing this:

gridAntenna.selectRowById(1, 0, true, true)

but the big problem is, i’m loading data from mysql, and in antenna table, id=1 it’s deleted … so in gridAntenna first id=3 now … but if I’m deleting id = 3 too, it will be first row id =4

How can I find what is first row id?


Get first row id

Thank you very much!
It is what I need

Auto select the first row, when i am displaying the grid? how can i do it? selectRow(0) is undefined in 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: