1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aoColumns.bVisible" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable( {
7 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
10 var oSettings = oTable.fnSettings();
13 "All columns are visible by default",
15 function () { return $('#example tbody tr:eq(0) td').length == 5; }
19 "Can hide one column and it removes td column from DOM",
22 $('#example').dataTable( {
23 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
27 { "bVisible": false },
34 function () { return $('#example tbody tr:eq(0) td').length == 4; }
38 "Can hide one column and it removes thead th column from DOM",
40 function () { return $('#example thead tr:eq(0) th').length == 4; }
44 "The correct thead column has been hidden",
47 var jqNodes = $('#example thead tr:eq(0) th');
49 jqNodes[0].innerHTML == "Rendering engine" &&
50 jqNodes[1].innerHTML == "Platform(s)" &&
51 jqNodes[2].innerHTML == "Engine version" &&
52 jqNodes[3].innerHTML == "CSS grade";
58 "The correct tbody column has been hidden",
60 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
63 var jqNodes = $('#example tbody tr:eq(0) td');
65 jqNodes[0].innerHTML == "Gecko" &&
66 jqNodes[1].innerHTML == "Gnome" &&
67 jqNodes[2].innerHTML == "1.8" &&
68 jqNodes[3].innerHTML == "A";
75 "Can hide multiple columns and it removes td column from DOM",
78 $('#example').dataTable( {
79 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
83 { "bVisible": false },
84 { "bVisible": false },
90 function () { return $('#example tbody tr:eq(0) td').length == 2; }
94 "Multiple hide - removes thead th column from DOM",
96 function () { return $('#example thead tr:eq(0) th').length == 2; }
100 "Multiple hide - the correct thead columns have been hidden",
103 var jqNodes = $('#example thead tr:eq(0) th');
105 jqNodes[0].innerHTML == "Rendering engine" &&
106 jqNodes[1].innerHTML == "Engine version"
112 "Multiple hide - the correct tbody columns have been hidden",
114 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
117 var jqNodes = $('#example tbody tr:eq(0) td');
119 jqNodes[0].innerHTML == "Gecko" &&
120 jqNodes[1].innerHTML == "1"