Issue in reordering rows
Issue in reordering rows
Hi
I am using reorder functionality through drag and drop of a row.
Normally, it is working fine, but when i have multiple line and i delete a row
t.on('click', 'tbody tr .btnDelete', function () {
t.row($(this).parents('tr'))
.remove()
.draw(true);
$.each($('#invoiceLines tr td:first-child'), function (index, val) {
$(this).html(index + 1);
});
});
after deleting, if i try to reorder the row again.... the sequence goes like
2
2
3
4
it does not start with 1.
Looking forward to your reply. Thanks
Answers
The code in this example might provide correct indexes for you.
https://datatables.net/examples/api/counter_columns.html
Kevin
Hi Kevin.
Thanks for your reply.
using this i get the correct indexs but still there is some issue with the reordering, as few rows are just stuck to reorder, but some works fine
You need to make sure the primary sorting is on the index column first. You can use
orderFixed
for this. If this doesn't help then we will need to see your page or a test case replicating the issue.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin