Using sDom to put DataTables to move dataTables event
Using sDom to put DataTables to move dataTables event
phtrivier
Posts: 1Questions: 0Answers: 0
I would like to display some of the controls that are displayed along the table (for example the "lengthChange" element or the pagination) inside another div of my page (assuming I know the id).
I tried doing setting fnDrawCallback to something like this : :
[code]
// ... in dataTables options ...
"fnDrawCallback" : function () {
// Moving the node created by dataTable
var lengthBox = $("#jquery_table_length").detach();
// Putting it in an existing node
$("#some_other_div").append(lengthBox);
}
// ...
[/code]
However, since I'm fetching the content from a DB, there is an ajax call during with the markup for the length change is visible at its initial position (before the first call to fnDrawCallback.
So I tried using sDom ( http://www.datatables.net/release-datatables/examples/basic_init/dom.html ), but apparently you can only customize the class of the Divs that DataTables creates ; you can know specify them.
Is there a clean way to implement this ?
Thanks
PH
I tried doing setting fnDrawCallback to something like this : :
[code]
// ... in dataTables options ...
"fnDrawCallback" : function () {
// Moving the node created by dataTable
var lengthBox = $("#jquery_table_length").detach();
// Putting it in an existing node
$("#some_other_div").append(lengthBox);
}
// ...
[/code]
However, since I'm fetching the content from a DB, there is an ajax call during with the markup for the length change is visible at its initial position (before the first call to fnDrawCallback.
So I tried using sDom ( http://www.datatables.net/release-datatables/examples/basic_init/dom.html ), but apparently you can only customize the class of the Divs that DataTables creates ; you can know specify them.
Is there a clean way to implement this ?
Thanks
PH
This discussion has been closed.