View Full Version : Working with two grid and row selection

17 Mar 2009, 4:34 AM
I have two Grid, when selecting a row in the first Grid A, I must highlight one or more corresponding row in my Grid B.

Is this possible?

What I am trying to do in my code is:

gridA.on('rowclick', function(grid, rowIndex, e){
var selectedRecord = grid.getStore().getAt(rowIndex);
var numSerie = selectedRecord.get('numeroserie');

// In the columns: array config propertie of my grid, I have an id:'numeroserie'
// From my var numSerie, I would like to find and highlight a row in my second grid
// gridB with the same value.
});I tried with Ext.DomQuery but I did not find a solution to my problem.
I tried gridB.getStore (). GetById (numSerie) to retrieve the record and highlight it.
but nothing works.

Any idea ?


17 Mar 2009, 4:46 AM
Here is a 'highlight' effect.
var gridBRow = gridB.getView().getRow(some#);
Ext.fly(gridBRow).highlight(); //or add class/etc.

If you want to select, you can use:

17 Mar 2009, 4:49 AM
simple logic i think this help you

function(grid, rowIndex, e) {
var selectedRecord = grid.getStore().getAt(rowIndex);
var numSerie = selectedRecord.get('numeroserie');
GridB.getStore().each(function(record) { // go throug each record of second grid
var checkFlag = matcher(record, numSerie); // custom matcher function
if (checkFlag) {
GridB.getSelection().selectRecords(record, true); // you must have Ext.grid.RowSelectionModel for this
funciton matcher(record, numSeries) {
var data = record.data;
if (data.YOURDATAFIELD === numSeries || data.YOURDATAFIELD2 == numSeries) {
return true;
return false;