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/objects.txt",
15 { "mData": "engine" },
18 "fnRender": function (a) {
23 return a.aData['browser'];
26 { "mData": "platform" },
27 { "mData": "version" },
31 var oSettings = oTable.fnSettings();
34 "Default for bUseRendered is true - rendered data is used for sorting",
35 function () { $('#example thead th:eq(1)').click(); },
36 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'aaa'; }
40 "When bUseRendered is false, original data is used for sorting",
44 oTable = $('#example').dataTable( {
45 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
47 { "mData": "engine" },
50 "bUseRendered": false,
51 "fnRender": function (a) {
56 return a.aData['browser'];
60 { "mData": "platform" },
61 { "mData": "version" },
65 $('#example thead th:eq(1)').click();
67 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
72 "bUseRendered set to false on one columns and true (default) on two others",
79 oTable = $('#example').dataTable( {
80 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
84 "fnRender": function (a) {
89 return a.aData['engine'];
95 "bUseRendered": false,
96 "fnRender": function (a) {
101 return a.aData['browser'];
107 "fnRender": function (a) {
112 return a.aData['platform'];
116 { "mData": "version" },
121 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'aaa1'; }
125 "Multi-column rendering - 2nd column sorting",
126 function () { $('#example thead th:eq(1)').click(); },
127 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
131 "Multi-column rendering - 3rd column sorting",
133 $('#example thead th:eq(2)').click();
134 $('#example thead th:eq(2)').click();
136 function () { return $('#example tbody tr:eq(0) td:eq(2)').html() == 'zzz3'; }
140 "Multi-column rendering - 4th column sorting",
141 function () { $('#example thead th:eq(3)').click(); },
142 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == '-'; }
146 "Multi-column rendering - 5th column sorting",
147 function () { $('#example thead th:eq(4)').click(); },
148 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }