PDA

View Full Version : Get the rows that are in a grid



rodiniz
6 Oct 2006, 6:50 AM
Hi Jack in your sample you dragging and droping between two grids.
But how do I get the rows that are in a grid ???
I want to know which rows are in which grid.

jack.slocum
6 Oct 2006, 7:01 AM
Hi Rodrigo,
The are added to the 2nd grid's data model. You can access them the same as accessing any row in the data model.



for(var i = 0, len = dataModel.getRowCount(); i < len; i++){
var row = dataModel.getRow(i);
// do something
}


Also, to be notified when rows are added or deleted, you can listen for the 'rowsinserted' and 'rowsdeleted' events. Both are documented on the AbstractDataModel.



function onRowsInserted(dataModel, firstRowIndex, lastRowIndex){
// do something
}
dataModel.addListener('rowsinserted', onRowsInserted);