3.2.0

Content Data from Grid not correct

Hi

i have a grid, and when i delete arow

obj.onCellDoubleClicked = function(event, col, row){obj.deleteRow(row);};

and i try to get the content of the grid object, it's not correct

var str='';
for(i=1;i<=obj.getRowCount();i++)
str+=obj.getCellText(1,i)+"\n";
alert(str);

internally it delete's always the last element, but visually it deletes the correct element
help is appreciated

thanks in advance
Nuno Silva
September 18,
Nuno,
The function obj.deleteRow(X) only hide X row and subtract one from RowCount.
But it does not phisically delete anything neither reorder any or all of the rows !!!

The way it hides the row is.. creating an array of indices by setRowIndices() ( empty by default) and store in it all the row numbers except the one deleted.
( setRowIndices() is also the main internal mechanism to order rows when sort operation is fired).
To see how it works check this:
obj.onCellDoubleClicked = function(event, col, row){
obj.deleteRow(row);
var visiblerows = obj.getRowIndices();
var str='';
for(i=0;i<obj.getRowCount();i++){
 str+=obj.getCellText(1,visiblerows[i])+"\n";
}
str+= obj.getRowCount()+"\n";
str+= obj.getRowIndices();
alert(str);
};
Carlos
September 18,
Also you can add this line just before the alert to check the last deleted 'index' (row) , this way a deleted row is still capable to be referenced because is just hidden for grid-display and could be 'recalled'
(undeleted) in case you need it by including it's index number inside RowIndices(array) .

str+= 'index deleted: ' + row + ' - ' + obj.getCellText(1,row);
HTH
Carlos
September 18,
Thank's i now understod the filosofy of the grid
it's logical

thank's for the help
Nuno Silva
September 19,

This topic is archived.

See also:


Back to support forum