Get rows after sorting
Get rows after sorting
adrian22
Posts: 6Questions: 3Answers: 0
Hi,
Great plugin!! But I have a problem with getting the right data back after sorting.
datatable.data().each(function(index, value) {
console.log($(index[0]).prop('id') + ' ' + value);
});
Gives me one row and the first id attrbute of node. The problem rises when I sort the list.
The loop gives me exactly the same data, even ordering/sorting have changed.
Please help!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
data()
will return an array of the data, in the original read order.If you want the data in the current order use
rows().data()
(see alsorows()
) with aselector-modifier
- e.g.table.rows( { order: 'current' } ).data()
.Allan
Thanks! Using api this is my solution.
,"drawCallback": function () {
pl.adata = this.api()
pl.afdata = pl.adata.rows({'order':'applied', 'search':'applied'}).data();
}