Jul 29, 2011, 6:17 PM
[CLOSED] Sync Row Selection Across 2 grids
Hi, I have 2 grid panels.
When I select a row in 1, I would like to also select the row in the other grid.
Vice-Versa.the problem naturally is that selecting 1 fires off the row select of the other...endless loop..how can I cancel the row select event after selecting a row?
Grid1
When I select a row in 1, I would like to also select the row in the other grid.
Vice-Versa.the problem naturally is that selecting 1 fires off the row select of the other...endless loop..how can I cancel the row select event after selecting a row?
function SyncSelections(dir) {
if (dir=='l')
{
Grid2.getSelectionModel().clearSelections();
for (var x = 0; x <= Grid2.getStore().getTotalCount() - 1; x++) {
if (Grid1.getSelectionModel().isSelected(x))
Grid2.getSelectionModel().selectRow(x, true);
}
}
else
Grid1.getSelectionModel().clearSelections();
for (var x = 0; x <= Grid1.getStore().getTotalCount() - 1; x++) {
if (Grid2.getSelectionModel().isSelected(x))
Grid1.getSelectionModel().selectRow(x, true);
}
}
The row selection model of each grid is as follows:Grid1
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel2" runat="server" SingleSelect="true" >
<Listeners>
<RowSelect Handler="SyncSelections('r')" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
Grid2
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel2" runat="server" SingleSelect="true" >
<Listeners>
<RowSelect Handler="SyncSelections('l')" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
Last edited by Daniil; Aug 02, 2011 at 2:02 PM.
Reason: [CLOSED]