1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "aoColumns.bUseRendered" );
4 /* bUseRendered is used to alter sorting data, if false then the original data is used for
5 * sorting rather than the rendered data
8 $(document).ready( function () {
9 /* Check the default */
12 var oTable = $('#example').dataTable( {
13 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
17 { "fnRender": function (a) {
18 if ( a.iDataRow == 0 ) {
22 return a.aData[a.iDataColumn];
29 var oSettings = oTable.fnSettings();
32 "Default for bUseRendered is true - rendered data is used for sorting",
33 function () { $('#example thead th:eq(1)').click(); },
34 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'aaa'; }
38 "When bUseRendered is false, original data is used for sorting",
42 oTable = $('#example').dataTable( {
43 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
48 "bUseRendered": false,
49 "fnRender": function (a) {
50 if ( a.iDataRow == 0 ) {
54 return a.aData[a.iDataColumn];
63 $('#example thead th:eq(1)').click();
65 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
70 "bUseRendered set to false on one columns and true (default) on two others",
77 oTable = $('#example').dataTable( {
78 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
82 "fnRender": function (a) {
83 if ( a.iDataRow == 0 ) {
87 return a.aData[a.iDataColumn];
92 "bUseRendered": false,
93 "fnRender": function (a) {
94 if ( a.iDataRow == 0 ) {
98 return a.aData[a.iDataColumn];
103 "fnRender": function (a) {
104 if ( a.iDataRow == 0 ) {
108 return a.aData[a.iDataColumn];
117 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'aaa1'; }
121 "Multi-column rendering - 2nd column sorting",
122 function () { $('#example thead th:eq(1)').click(); },
123 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
127 "Multi-column rendering - 3rd column sorting",
129 $('#example thead th:eq(2)').click();
130 $('#example thead th:eq(2)').click();
132 function () { return $('#example tbody tr:eq(0) td:eq(2)').html() == 'zzz3'; }
136 "Multi-column rendering - 4th column sorting",
137 function () { $('#example thead th:eq(3)').click(); },
138 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == '-'; }
142 "Multi-column rendering - 5th column sorting",
143 function () { $('#example thead th:eq(4)').click(); },
144 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }