How to get all visible column index's in reorderCallback for serverside DataTable
How to get all visible column index's in reorderCallback for serverside DataTable
emperordevil.gupta
Posts: 6Questions: 3Answers: 0
Hi,
I'm using server side DataTable, where i want to see what are the current index of column after dragging or changing position.
My JS code is
table = $('#user-table').DataTable({
iDisplayLength: 10,
aLengthMenu: [[1, 10, 100, 200, 300, 500], [1, 10, 100, 200, 300, 500]],
processing: true,
serverSide: true,
scrollX: true,
ajax: user_url,
columns: [
{data: 'action', name: 'action', orderable: false, searchable: false},
{data: 'id', name: 'id'},
{data: 'first_name', name: 'first_name'},
{data: 'last_name', name: 'last_name'},
{data: 'username', name: 'username'}
],
// colReorder: true,
dom: 'Rlfrtip',
colReorder: {
reorderCallback: function () {
//here I want to get the the current col index's
});
}
},
initComplete: function () {
//my code
},
fnDrawCallback: function () {
//my code
}
});
When the table load index are [0, 1, 2, 3, 4] if user drag and move the 'id' column after 'username' column then i want to get array of index with current position, which i'll save it and when user will come back to this listing i'll use
table.colReorder.order([]);//new order array of index.
Any input will be helpfull thanks.
This discussion has been closed.