bVisible not working
bVisible not working
I have 2 tables, one that is loaded when the page loads and another that is done via ajax. I am creating each table based off the id of the table. When you click a radio button, it hides the one div and shows the other and creates the table. I can only get the ajax loaded table to appear if i destroy the previous one.
That all works fine but it breaks when I want to hide certain columns. It works fine for the non-ajax table, but when i do anything related to hiding columns the table data will not appear at all.
Here is what I have tried using aoColumns and aoColumnDefs.
[code]
oTable.fnDestroy();
oTable = $('#searchT').dataTable({
"sPaginationType": "full_numbers",
"aaSorting": [[ 7, "desc" ]],
"aoColumns": [
/* col1*/ {"bVisible": false },
/* col2*/ {"bVisible": false },
/* col3*/ {"bVisible": false },
/* col4*/ null,
/* col5*/ null,
/* col6*/ null,
/* col7 */ null,
/* col8*/ null,
/* col9 */ null
]
});
oTable = $('#searchT').dataTable({
"sPaginationType": "full_numbers",
"aaSorting": [[ 7, "desc" ]],
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [ 0,1,2,8 ] },
{ "bSortable": false, "aTargets": [ 0,1,2 ] }
],
"aLengthMenu": [15, 25, 50],
"bScrollCollapse": false,
"iDisplayLength": 15,
"bRetrieve": true
});
[/code]
I even created a function so i can use the console in Chrome to hide it, and that's the only way it will hide. Any one have any ideas on why I cannot hide columns?
That all works fine but it breaks when I want to hide certain columns. It works fine for the non-ajax table, but when i do anything related to hiding columns the table data will not appear at all.
Here is what I have tried using aoColumns and aoColumnDefs.
[code]
oTable.fnDestroy();
oTable = $('#searchT').dataTable({
"sPaginationType": "full_numbers",
"aaSorting": [[ 7, "desc" ]],
"aoColumns": [
/* col1*/ {"bVisible": false },
/* col2*/ {"bVisible": false },
/* col3*/ {"bVisible": false },
/* col4*/ null,
/* col5*/ null,
/* col6*/ null,
/* col7 */ null,
/* col8*/ null,
/* col9 */ null
]
});
oTable = $('#searchT').dataTable({
"sPaginationType": "full_numbers",
"aaSorting": [[ 7, "desc" ]],
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [ 0,1,2,8 ] },
{ "bSortable": false, "aTargets": [ 0,1,2 ] }
],
"aLengthMenu": [15, 25, 50],
"bScrollCollapse": false,
"iDisplayLength": 15,
"bRetrieve": true
});
[/code]
I even created a function so i can use the console in Chrome to hide it, and that's the only way it will hide. Any one have any ideas on why I cannot hide columns?
This discussion has been closed.
Replies
Allan