PDA

View Full Version : Highlight multiple rows in GridPanel



winklerd
24 Nov 2010, 8:16 AM
Hello,

I have a GridPanel that is listing up to 100 records and I have a separate panel that has a graphical representation of those records. When a user clicks on a node in the graphical panel, I want it to highlight the associated rows in the GridPanel. Is there a way to do this easily? If not, can someone point me in the right direction to a more complex solution?

Thanks!

solovieff13
24 Nov 2010, 10:39 AM
Hi, you should change the style of rows you need like this:

Ext.fly(your_grid.getView().getRow(i)).addClass('x-grid3-summary-row td');
Or you can set the rows you want selected.

Screamy
24 Nov 2010, 10:53 AM
First, be sure that your Grid's RowSelectionModel allows for multi-row selection:



var g = new Ext.grid.GridPanel({
sm: new Ext.grid.RowSelectionModel({singleSelect: false}),
<...snip...>
})
Then you can use the RowSelectionModel to select/deselect any rows you want:



g.selModel.select(4, true); // selects row 4 and keeps any existing selections.
See the Ext.grid.RowSelectionModel docs for more info.