1 // DATA_TEMPLATE: js_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( {
16 { "fnRender": function (a) {
21 return a.aData[a.iDataColumn];
28 var oSettings = oTable.fnSettings();
31 "Default for bUseRendered is true - rendered data is used for sorting",
32 function () { $('#example thead th:eq(1)').click(); },
33 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'aaa'; }
37 "When bUseRendered is false, original data is used for sorting",
41 oTable = $('#example').dataTable( {
46 "bUseRendered": false,
47 "fnRender": function (a) {
52 return a.aData[a.iDataColumn];
61 $('#example thead th:eq(1)').click();
63 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
68 "bUseRendered set to false on one columns and true (default) on two others",
75 oTable = $('#example').dataTable( {
79 "fnRender": function (a) {
84 return a.aData[a.iDataColumn];
89 "bUseRendered": false,
90 "fnRender": function (a) {
95 return a.aData[a.iDataColumn];
100 "fnRender": function (a) {
105 return a.aData[a.iDataColumn];
114 function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'aaa1'; }
118 "Multi-column rendering - 2nd column sorting",
119 function () { $('#example thead th:eq(1)').click(); },
120 function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; }
124 "Multi-column rendering - 3rd column sorting",
126 $('#example thead th:eq(2)').click();
127 $('#example thead th:eq(2)').click();
129 function () { return $('#example tbody tr:eq(0) td:eq(2)').html() == 'zzz3'; }
133 "Multi-column rendering - 4th column sorting",
134 function () { $('#example thead th:eq(3)').click(); },
135 function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == '-'; }
139 "Multi-column rendering - 5th column sorting",
140 function () { $('#example thead th:eq(4)').click(); },
141 function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; }