PDA

View Full Version : How to click the GridPanel's row automatically



adminadmin
8 Feb 2010, 12:48 AM
Hello everyone, I want to click a Ext.grid.GridPanel's row automatically as follows:

grid.fireEvent('rowclick', this, 0); // It means click the first row of the grid

I found the click event was completed successfully but the question is that the row which is clicked didn't change its bgcolor after the above code had executed. However, as we know, if we click a row manually with our mouse, then the row's bgcolor will change to thin blue.

Obviouslly, I can change the row's bgcolor with css manually after the clicking code executed, but I don't think that's a good way.

So can anyone help me, how to click a grid's row and change its bgcolor? Thanks a lot~~

jbo87
8 Feb 2010, 4:29 AM
Look up if selectRow (http://test.jbo.hoff.mindwerk.local/ext-3.1.0/docs/?class=Ext.grid.RowSelectionModel) may help.

adminadmin
8 Feb 2010, 5:32 AM
Look up if selectRow (http://test.jbo.hoff.mindwerk.local/ext-3.1.0/docs/?class=Ext.grid.RowSelectionModel) may help.
Thanks so much~~~~
grid.getSelectionModel().selectRow(row); can solve the problem perfectly. There isn't any explanation of SelectinModel in extJS api, I found the selectRow method as you supply by firebug. Thanks again~~:D