| 1 |
// DATA_TEMPLATE: empty_table |
| 2 |
oTest.fnStart( "aoColumns.bUseRendered" ); |
| 3 |
|
| 4 |
/* bUseRendered is used to alter sorting data, if false then the original data is used for |
| 5 |
* sorting rather than the rendered data |
| 6 |
*/ |
| 7 |
|
| 8 |
$(document).ready( function () { |
| 9 |
/* Check the default */ |
| 10 |
var mTmp = 0; |
| 11 |
|
| 12 |
var oTable = $('#example').dataTable( { |
| 13 |
"bServerSide": true, |
| 14 |
"sAjaxSource": "../../../examples/server_side/scripts/server_processing.php", |
| 15 |
"aoColumns": [ |
| 16 |
null, |
| 17 |
{ "fnRender": function (a) { |
| 18 |
if ( mTmp == 0 ) { |
| 19 |
mTmp++; |
| 20 |
return "aaa"; |
| 21 |
} else |
| 22 |
return a.aData[a.iDataColumn]; |
| 23 |
} }, |
| 24 |
null, |
| 25 |
null, |
| 26 |
null |
| 27 |
] |
| 28 |
} ); |
| 29 |
var oSettings = oTable.fnSettings(); |
| 30 |
|
| 31 |
oTest.fnWaitTest( |
| 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'; } |
| 35 |
); |
| 36 |
|
| 37 |
/* Limited to what we can do here as the sorting is done on the server side. So stop here. */ |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
oTest.fnComplete(); |
| 43 |
} ); |