http://legacy.datatables.net/usage/callbacks#fnRowCallback
主要通过 fnCreatedRow 事件来实现
var table = $('#table_id').dataTable( {
"processing": true,
"serverSide": true,
"ajax": {
"url": "#",
"type": "POST",
"data" : { "action" : "table-ajax-data" }
},
"columns": [
{ "data": 'id', "name": '编号', "width": '80px' },
{ "data": 'cat', "name": '分类' },
{ "data": 'sub_cat', "name": '子类', "orderable": false, "visible": false, "searchable": false }
],
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
if( typeof( aData.id ) != "undefined" ) {
$( nRow ).attr( "tr_id", aData.id );
}
}
} );