PDA

View Full Version : go through each cell of a datagrid


alexandre_lab
03-22-2005, 02:45 PM
hello boyz and girlz,

i'm trying to go through each cell of a dataGrid component.

any idea how to loop through it ?

i tried this:


for (i=0; i<myDataGrid.columnCount; i++) {
thisColumnNumRows = myDataGrid.getColumnAt(i).rowCount;
trace("\n column n° "+i+" a "+thisColumnNumRows+" rows.");
for (j=0; j<thisColumnNumRows; j++) {
trace ("my cell is col:"+i+" and row : "+j+"\n");
}
}


it works for the columns but not for the rows...

any idea ?

Xeef
03-22-2005, 03:03 PM
grid.dataProvider = [{T:"B", name:"Chris", price:"Priceless"}, {T:"A", name:"Nigel", price:"cheap"}];
for (a in grid.dataProvider) {
trace(a)
for (b in grid.dataProvider[a]) {
trace(" "+grid.dataProvider[a][b]);
}
}

alexandre_lab
03-22-2005, 09:18 PM
thanks a lot ! it works...

but i need that b be the column Index number, not the name of the column itself, as i sometimes need to jump two cells ahead, and get that cell's value, in other words, i need to get the mydatagrid[a][b+2] value...
right now it does not work because my columns have names