how to add settings for table with special ID to html page?
how to add settings for table with special ID to html page?
There is a way to add settings to table with special ID in script.js:
$(document).ready( function () {
var dtDefaults = {
dom: '<"H"Bfr>t<"F"ip>',
jQueryUI: true,
buttons: [ 'colvis',
{extend: 'collection', text: 'Select Type ↓', buttons: ['selectCells' , 'selectRows', 'selectColumns']},
'selectAll', 'selectNone', 'pageLength'],
select: {info: true, style: 'multi'},
pagingType: "full_numbers",lengthMenu: [[ 10, 25, 50, 100, -1 ],[ '10', '25', '50', '100', 'All' ]]
};
var table1 = $('.tabula').DataTable($.extend(dtDefaults, {}));
var table2 = $('#nas1tab2').DataTable($.extend(dtDefaults, {columnDefs: [{"targets": [ -1,-2,-3 ],"visible": false}]}));
});
But how to add settings for '#nas1tab2' table to html page, between script tags if in script.js exists:
$(document).ready( function () {
var dtDefaults = {
dom: '<"H"Bfr>t<"F"ip>',
jQueryUI: true,
buttons: [ 'colvis',
{extend: 'collection', text: 'Select Type ↓', buttons: ['selectCells' , 'selectRows', 'selectColumns']},
'selectAll', 'selectNone', 'pageLength'],
select: {info: true, style: 'multi'},
pagingType: "full_numbers",lengthMenu: [[ 10, 25, 50, 100, -1 ],[ '10', '25', '50', '100', 'All' ]]
};
var table1 = $('.tabula').DataTable($.extend(dtDefaults, {}));
});
This question has an accepted answers - jump to answer
Answers
Is this the same thing as this one?
Your question is very poorly phrased.. "add settings between script tags".. just add them to the Datatable instance...
I am interested how to move this part
from JavaScript to Html between script tags
See screenshot: http://postimg.org/image/vqjkm4s0l/
Example: http://live.datatables.net/qixeboli/1/
Oh.. just move it there, and put it in another
$(document).ready ()
like the other one.It wont see the
dbDefaults
variable thiugh. If you want it to, you might have to dowindow.dbDefaults
or somethingI know about
$(document).ready ()
, I don't know how to use dbDefaults there.I tried so many options.
and etc.
Read the last section of my post..
Thanks. I simply replaced dtDefaults with window.dbDefaults and all works.