Trying to append lengthMenu to a predefined div element. Is this possible?
Trying to append lengthMenu to a predefined div element. Is this possible?
Div
<div id="VeiwSelect" style="float:right;"></div>
```$(document).ready(function () {
var table = $('#waiversOnLineReport').DataTable({
"bSort": true,
"pagingType": "full_numbers",
"dom": 'T<"clear">lbrtip',
"lengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]],
"language": {
"lengthMenu": "View MENU records per page"
}
});```
And With
"dom": 'T<"clear"><"#id VeiwSelect"l>brtip',
Tried to use it like button: No luck
var lengthMenu = new $.fn.dataTable.lengthMenu(table, {
lengthMenu:
[{
tag: 'VeiwSelect',
text: 'Hello'
}]
}).container().appendTo($('#VeiwSelect'));
This question has an accepted answers - jump to answer
Answers
Found solution from https://datatables.net//forums/discussion/36614
$('#waiversOnLineReport_length').appendTo('#VeiwSelect');
Yes - this is exactly correct. The
initComplete
method can be used to know when to execute thatappendTo
.Allan