1 // DATA_TEMPLATE: dom_data
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( {
15 { "fnRender": function (a) {
20 return a.aData[a.iDataColumn];
27 var oSettings = oTable.fnSettings();
30 "Default for bUseRendered is true - rendered data is used for sorting",
31 function () { $('#example thead th:eq(1)').click(); },
32 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'aaa'; }
36 "When bUseRendered is false, original data is used for sorting",
40 oTable = $('#example').dataTable( {
44 "bUseRendered": false,
45 "fnRender": function (a) {
50 return a.aData[a.iDataColumn];
59 $('#example thead th:eq(1)').click();
61 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
66 "bUseRendered set to false on one columns and true (default) on two others",
73 oTable = $('#example').dataTable( {
76 "fnRender": function (a) {
81 return a.aData[a.iDataColumn];
86 "bUseRendered": false,
87 "fnRender": function (a) {
92 return a.aData[a.iDataColumn];
97 "fnRender": function (a) {
102 return a.aData[a.iDataColumn];
111 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'aaa1'; }
115 "Multi-column rendering - 2nd column sorting",
116 function () { $('#example thead th:eq(1)').click(); },
117 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
121 "Multi-column rendering - 3rd column sorting",
123 $('#example thead th:eq(2)').click();
124 $('#example thead th:eq(2)').click();
126 function () { return $('#example tbody tr:eq(0) td:eq(2)').html() == 'zzz3'; }
130 "Multi-column rendering - 4th column sorting",
131 function () { $('#example thead th:eq(3)').click(); },
132 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == '-'; }
136 "Multi-column rendering - 5th column sorting",
137 function () { $('#example thead th:eq(4)').click(); },
138 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }