Hide/Show table programmatically?
Hide/Show table programmatically?
orange_roughy
Posts: 19Questions: 0Answers: 0
Hi,
I have a datable which I want to hide initially. When a users clicks a button, the datatable appears. I've tried a few ideas, all of which have their problems. Here are a couple:
[code]
$("#my-table").hide() // table is initially hidden as I add table rows to it using jQuery
$("#my-table").dataTable(); // turn it into a datable
$(#my-table_wrapper).hide(); //datables creates a div with my-table_wrapper
// user clicks button...
$(#my-table_wrapper).show();
[/code]
That results in the datable always being hidden; I don't know why, perhaps you are using jQuery.toggle() somewhere?
Another attempt:
[code]
....
$("#table-wrapper").hide() // table is initially hidden as I add table rows to it using jQuery
// user clicks button...
$(#table-wrapper).show();
[/code]
That results in the column everything showing correctly *except* the thead, which contains my filter boxes per http://www.datatables.net/examples/api/multi_filter.html
Here is how I'm creating the datable:
[code]
var myTable= $("#my-table").dataTable({
"bScrollInfinite": true,
"bScrollCollapse": true,
"sScrollY": "200px",
"oLanguage": {
"sSearch": "Global Search:"
}
});
[/code]
Help!
Thank you,
orange_roughy
I have a datable which I want to hide initially. When a users clicks a button, the datatable appears. I've tried a few ideas, all of which have their problems. Here are a couple:
[code]
$("#my-table").hide() // table is initially hidden as I add table rows to it using jQuery
$("#my-table").dataTable(); // turn it into a datable
$(#my-table_wrapper).hide(); //datables creates a div with my-table_wrapper
// user clicks button...
$(#my-table_wrapper).show();
[/code]
That results in the datable always being hidden; I don't know why, perhaps you are using jQuery.toggle() somewhere?
Another attempt:
[code]
....
$("#table-wrapper").hide() // table is initially hidden as I add table rows to it using jQuery
// user clicks button...
$(#table-wrapper).show();
[/code]
That results in the column everything showing correctly *except* the thead, which contains my filter boxes per http://www.datatables.net/examples/api/multi_filter.html
Here is how I'm creating the datable:
[code]
var myTable= $("#my-table").dataTable({
"bScrollInfinite": true,
"bScrollCollapse": true,
"sScrollY": "200px",
"oLanguage": {
"sSearch": "Global Search:"
}
});
[/code]
Help!
Thank you,
orange_roughy
This discussion has been closed.
Replies
So, show then fnAdjustColumnSizing :-)
Allan
Allan