1 // DATA_TEMPLATE: dom_data
2 oTest.fnStart( "aoColumns.bVisible" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable();
7 var oSettings = oTable.fnSettings();
10 "All columns are visible by default",
12 function () { return $('#example tbody tr:eq(0) td').length == 5; }
16 "Can hide one column and it removes td column from DOM",
19 $('#example').dataTable( {
22 { "bVisible": false },
29 function () { return $('#example tbody tr:eq(0) td').length == 4; }
33 "Can hide one column and it removes thead th column from DOM",
35 function () { return $('#example thead tr:eq(0) th').length == 4; }
39 "Can hide one column and it removes tfoot th column from DOM",
41 function () { return $('#example tfoot tr:eq(0) th').length == 4; }
45 "The correct thead column has been hidden",
48 var jqNodes = $('#example thead tr:eq(0) th');
50 jqNodes[0].innerHTML == "Rendering engine" &&
51 jqNodes[1].innerHTML == "Platform(s)" &&
52 jqNodes[2].innerHTML == "Engine version" &&
53 jqNodes[3].innerHTML == "CSS grade";
59 "The correct tbody column has been hidden",
61 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
64 var jqNodes = $('#example tbody tr:eq(0) td');
66 jqNodes[0].innerHTML == "Gecko" &&
67 jqNodes[1].innerHTML == "Gnome" &&
68 jqNodes[2].innerHTML == "1.8" &&
69 jqNodes[3].innerHTML == "A";
76 "Can hide multiple columns and it removes td column from DOM",
79 $('#example').dataTable( {
82 { "bVisible": false },
83 { "bVisible": false },
89 function () { return $('#example tbody tr:eq(0) td').length == 2; }
93 "Multiple hide - removes thead th column from DOM",
95 function () { return $('#example thead tr:eq(0) th').length == 2; }
99 "Multiple hide - removes tfoot th column from DOM",
101 function () { return $('#example tfoot tr:eq(0) th').length == 2; }
105 "Multiple hide - the correct thead columns have been hidden",
108 var jqNodes = $('#example thead tr:eq(0) th');
110 jqNodes[0].innerHTML == "Rendering engine" &&
111 jqNodes[1].innerHTML == "Engine version"
117 "Multiple hide - the correct tbody columns have been hidden",
119 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
122 var jqNodes = $('#example tbody tr:eq(0) td');
124 jqNodes[0].innerHTML == "Gecko" &&
125 jqNodes[1].innerHTML == "1"