Search/Sorting not working when using aoColumns
Search/Sorting not working when using aoColumns
DevMark
Posts: 1Questions: 0Answers: 0
Hello,
All data get from Server Side. When i go to search and sort data, it is always return completely data json from server.(sSearch can POST TO SERVER)
It means that my server can return perfectly. Also means that using fnDraw or fnreload are not solution for me.
If i do not using aoColumns/aoColumnDefs , it can work great.
So what function should i use to fix it?
[code]
var oTable = $('.datatable').dataTable({
"sDom": "<'row'<'col-xs-6'T><'col-xs-6'f>r>t<'row'<'col-xs-6'i><'col-xs-6'p>>",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "list_all",
"aoColumns": [
{"sTitle":"Title", "sClass": "title", "mData":"title", "sType":"string"},
{"sTitle":"au",
"sClass": "no_mobile",
"mData":"lastname",
"sType":"string",
"mRender":function(data, type, row){
return row.lastname + " " + row.firstname;
}
},
{"sTitle":"cate", "sClass": "no_mobile", "mData":"name"},
{"sTitle":"date", "sClass": "no_mobile", "mData":"date_upd"},
{"sTitle":"st", "sClass": "no_mobile", "mData":"status"},
],
"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"dataType": 'JSON',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
"oTableTools": {
"sSwfPath": "js/dataTables/ZeroClipboard/swf/copy_csv_xls_pdf.swf",
"sRowSelect": "multi",
"aButtons": [ "select_all", "select_none" ]
}
});
[/code]
All data get from Server Side. When i go to search and sort data, it is always return completely data json from server.(sSearch can POST TO SERVER)
It means that my server can return perfectly. Also means that using fnDraw or fnreload are not solution for me.
If i do not using aoColumns/aoColumnDefs , it can work great.
So what function should i use to fix it?
[code]
var oTable = $('.datatable').dataTable({
"sDom": "<'row'<'col-xs-6'T><'col-xs-6'f>r>t<'row'<'col-xs-6'i><'col-xs-6'p>>",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "list_all",
"aoColumns": [
{"sTitle":"Title", "sClass": "title", "mData":"title", "sType":"string"},
{"sTitle":"au",
"sClass": "no_mobile",
"mData":"lastname",
"sType":"string",
"mRender":function(data, type, row){
return row.lastname + " " + row.firstname;
}
},
{"sTitle":"cate", "sClass": "no_mobile", "mData":"name"},
{"sTitle":"date", "sClass": "no_mobile", "mData":"date_upd"},
{"sTitle":"st", "sClass": "no_mobile", "mData":"status"},
],
"fnServerData": function ( sSource, aoData, fnCallback, oSettings ) {
oSettings.jqXHR = $.ajax( {
"dataType": 'JSON',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
"oTableTools": {
"sSwfPath": "js/dataTables/ZeroClipboard/swf/copy_csv_xls_pdf.swf",
"sRowSelect": "multi",
"aButtons": [ "select_all", "select_none" ]
}
});
[/code]
This discussion has been closed.
Replies
Allan