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"
9 var oSettings = oTable.fnSettings();
12 "All columns are visible by default",
14 function () { return $('#example tbody tr:eq(0) td').length == 5; }
18 "Can hide one column and it removes td column from DOM",
21 $('#example').dataTable( {
22 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
25 { "bVisible": false },
32 function () { return $('#example tbody tr:eq(0) td').length == 4; }
36 "Can hide one column and it removes thead th column from DOM",
38 function () { return $('#example thead tr:eq(0) th').length == 4; }
42 "The correct thead column has been hidden",
45 var jqNodes = $('#example thead tr:eq(0) th');
47 jqNodes[0].innerHTML == "Rendering engine" &&
48 jqNodes[1].innerHTML == "Platform(s)" &&
49 jqNodes[2].innerHTML == "Engine version" &&
50 jqNodes[3].innerHTML == "CSS grade";
56 "The correct tbody column has been hidden",
58 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
61 var jqNodes = $('#example tbody tr:eq(0) td');
63 jqNodes[0].innerHTML == "Gecko" &&
64 jqNodes[1].innerHTML == "Gnome" &&
65 jqNodes[2].innerHTML == "1.8" &&
66 jqNodes[3].innerHTML == "A";
73 "Can hide multiple columns and it removes td column from DOM",
76 $('#example').dataTable( {
77 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
80 { "bVisible": false },
81 { "bVisible": false },
87 function () { return $('#example tbody tr:eq(0) td').length == 2; }
91 "Multiple hide - removes thead th column from DOM",
93 function () { return $('#example thead tr:eq(0) th').length == 2; }
97 "Multiple hide - the correct thead columns have been hidden",
100 var jqNodes = $('#example thead tr:eq(0) th');
102 jqNodes[0].innerHTML == "Rendering engine" &&
103 jqNodes[1].innerHTML == "Engine version"
109 "Multiple hide - the correct tbody columns have been hidden",
111 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
114 var jqNodes = $('#example tbody tr:eq(0) td');
116 jqNodes[0].innerHTML == "Gecko" &&
117 jqNodes[1].innerHTML == "1"