Adding dynamic checkboxes to the header of a table
Adding dynamic checkboxes to the header of a table
shewless
Posts: 3Questions: 0Answers: 0
Hi. I've seen other questions similar to this but they don't answer my questions.
You can see here I'm using the "sDom" to add some html to my header. Also I'm using jQueryUI so I need to use "H" and "F" to get my pretty styling.
[code]
$(document).ready(function() {
$('table.display').dataTable( {
"bJQueryUI": true,
"sDom": '<"H"lfr<"toolbar">>t<"F"ip>'
});
$("div.toolbar").html('want checkbox');
});
[/code]
What I'd like to know is two things:
1: How do I use javascript to add checkboxes (is there a better way than .html)
2: Really I would like to add these checkboxes in my "html" file itself (where the is defined. How can I do this in such a way that I can define the checkboxes in my html and have them included in the table header?
Thank you!
You can see here I'm using the "sDom" to add some html to my header. Also I'm using jQueryUI so I need to use "H" and "F" to get my pretty styling.
[code]
$(document).ready(function() {
$('table.display').dataTable( {
"bJQueryUI": true,
"sDom": '<"H"lfr<"toolbar">>t<"F"ip>'
});
$("div.toolbar").html('want checkbox');
});
[/code]
What I'd like to know is two things:
1: How do I use javascript to add checkboxes (is there a better way than .html)
2: Really I would like to add these checkboxes in my "html" file itself (where the is defined. How can I do this in such a way that I can define the checkboxes in my html and have them included in the table header?
Thank you!
This discussion has been closed.
Replies
http://www.datatables.net/ref
To add items into header or footer cells you need to use standard DOM or jQuery methods - DataTables doesn't provide an API for that kind of manipulation.
Allan