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/objects.txt",
10 { "mData": "browser" },
11 { "mData": "platform" },
12 { "mData": "version" },
16 var oSettings = oTable.fnSettings();
19 "All columns are visible by default",
21 function () { return $('#example tbody tr:eq(0) td').length == 5; }
25 "Can hide one column and it removes td column from DOM",
28 $('#example').dataTable( {
29 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
31 { "mData": "engine" },
32 { "mData": "browser", "bVisible": false },
33 { "mData": "platform" },
34 { "mData": "version" },
39 function () { return $('#example tbody tr:eq(0) td').length == 4; }
43 "Can hide one column and it removes thead th column from DOM",
45 function () { return $('#example thead tr:eq(0) th').length == 4; }
49 "The correct thead column has been hidden",
52 var jqNodes = $('#example thead tr:eq(0) th');
54 jqNodes[0].innerHTML == "Rendering engine" &&
55 jqNodes[1].innerHTML == "Platform(s)" &&
56 jqNodes[2].innerHTML == "Engine version" &&
57 jqNodes[3].innerHTML == "CSS grade";
63 "The correct tbody column has been hidden",
65 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
68 var jqNodes = $('#example tbody tr:eq(0) td');
70 jqNodes[0].innerHTML == "Gecko" &&
71 jqNodes[1].innerHTML == "Gnome" &&
72 jqNodes[2].innerHTML == "1.8" &&
73 jqNodes[3].innerHTML == "A";
80 "Can hide multiple columns and it removes td column from DOM",
83 $('#example').dataTable( {
84 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
86 { "mData": "engine" },
87 { "mData": "browser", "bVisible": false },
88 { "mData": "platform", "bVisible": false },
89 { "mData": "version" },
90 { "mData": "grade", "bVisible": false }
94 function () { return $('#example tbody tr:eq(0) td').length == 2; }
98 "Multiple hide - removes thead th column from DOM",
100 function () { return $('#example thead tr:eq(0) th').length == 2; }
104 "Multiple hide - the correct thead columns have been hidden",
107 var jqNodes = $('#example thead tr:eq(0) th');
109 jqNodes[0].innerHTML == "Rendering engine" &&
110 jqNodes[1].innerHTML == "Engine version"
116 "Multiple hide - the correct tbody columns have been hidden",
118 oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } );
121 var jqNodes = $('#example tbody tr:eq(0) td');
123 jqNodes[0].innerHTML == "Gecko" &&
124 jqNodes[1].innerHTML == "1"