:: Forum >>
how to delete row from sorted grid
I am not sure what is the purpose of the deleteRow method. To delete a row from sorted grid I came up with the code:
var Row = TheGrid.getCurrentRow();
var SortIndex = TheGrid.getRowIndices();
if (SortIndex)
{
SortIndex.splice(TheGrid.getRowPosition(Row), 1);
var offset = TheGrid.getRowOffset();
for(var i = 0; i < SortIndex.length; ++i)
if (SortIndex[i] > Row + offset)
--SortIndex[i];
TheGrid.setRowIndices(SortIndex);
}
GridData.splice(Row, 1);
Is there a simpler method? Should not the deleteRow method handle it? I found that the following code will not work.
var Row = TheGrid.getCurrentRow();
TheGrid.deleteRow(Row);
GridData.splice(Row, 1);
Adam Zielinski
Wednesday, April 12, 2006
You should use deleteRow(index) method to tell the grid that the row with this index should no longer be rendered. The grid removes the given index from the array of row indices. However you should not remove the row from you js array, otherwise all row indices will change!
Alex (ActiveWidgets)
Thursday, April 13, 2006
Thanks Alex for prompt response.
Unfortunately I cannot afford to not remove the item from the JS array. In my business logic I have used two grids to construct dual select. The user by moving items between grids makes selection. Now if the user will move the same item couple of times between the grids in reality he will have lots of duplicates without knowing (seeing) it. I need to keep the JS array as tidy as the internal indices are.
Thanks
Adam
Adam Zielinski
Thursday, April 13, 2006
Alex (ActiveWidgets)
Thursday, April 13, 2006
Hi Alex,
Thank you for a new approach. I would have to look what it takes for your algorithm to re-edit existing two sets of data. Unfortunately the project is already in QA and I cannot afford to redesign my original approach in current release.
Tanks again
Adam
Adam Zielinski
Monday, May 1, 2006
This topic is archived.
Back to support forum
Forum search