row.add() does not add row at the end of table
row.add() does not add row at the end of table
SubCon
Posts: 2Questions: 1Answers: 0
Hello,
Just started using DT, I think I found a bug, exaple here
row.add() adds row on top. I found that if first column of the table is numeric (like: 1,2,3 etc..), than the new row will be added at the bottom as expected. But if numbers are 1,2,5 - row will be added on (3) after 2 first rows. There are 3 examples in the link provided so to see the problem clearly.
This discussion has been closed.
Answers
Hi,
Thanks for providing a test case. This is fully expected - the new data is inserted into the table and sorted according to the sorting applied to the table. So in the second table it is correct that the new row would cause the first column to be 1, 2, 5, 7. With sorting applied to the first column having the data as 1, 2, 7, 5 would be wrong!
Allan
So if I understand correctly, the sorting is applied by default on first column. Since in many cases this column will not be numeric and consistant, is there some option to apply so that I will not have to worry about this and have new rows added at the end?
You could disable ordering (
ordering
) in which case the rows will be displayed in the order they have been added to the DataTable.Allan