Add new row, but not as last one
Add new row, but not as last one
Hi,
I need to be able to add rows in a n arbitrary position in the grid.
fnAddData doesn't seem to support that.
One solution that comes to mind is to add using fnAddData, and then count on resorting to order the elements in the way that I want, but this seems awkward.
Is there a more elegant way to do this ?
10x,
Ido
I need to be able to add rows in a n arbitrary position in the grid.
fnAddData doesn't seem to support that.
One solution that comes to mind is to add using fnAddData, and then count on resorting to order the elements in the way that I want, but this seems awkward.
Is there a more elegant way to do this ?
10x,
Ido
This discussion has been closed.
Replies
Positioning in DataTables in determined solely by sorting (it is possible to override this by disabling sorting and manipulating the aiDisplay and aiDisplayMaster internal elements as you required) - which is the reason that fnAddData() doesn't allow the new row to go into a particular position, because it doesn't mean anything to DataTables.
What can be done to achieve this effect though, is to have a hidden column which will be sorted upon (aaSortingFixed can be used to force sorting to always happen on a particular column first) and the index/position would be in that column.
Hope that helps,
Allan