How to disable the sorting click on table header when server side data is still processing?
How to disable the sorting click on table header when server side data is still processing?
Hi All,
I'm doing the server side sorting in datatable plugin .Data takes 4-5 seconds to load, in the mean time if the user clicks on other headers it will again trigger the ajax call.
Please help me on how to restrict the user when the servers side data is still in processing state.
Is there any initial function where i can check custom Flag status & stop the sortable.??
Highly appreciate the quick response.
Thanks,
Janardhan
I'm doing the server side sorting in datatable plugin .Data takes 4-5 seconds to load, in the mean time if the user clicks on other headers it will again trigger the ajax call.
Please help me on how to restrict the user when the servers side data is still in processing state.
Is there any initial function where i can check custom Flag status & stop the sortable.??
Highly appreciate the quick response.
Thanks,
Janardhan
This discussion has been closed.
Replies
Allan
First, thanks a lot for replying.
It's an optimised one though :).But it takes around 1-3 seconds as the display data is complex & its based on the user data (ranges from low to high).
I'm displaying the 250 rows in the table by doing the complex json parsing (heavy UI intense rows) via ajax (also complex biz logic along with sort :)) so is the accepted delay.
I'm using the fnServerData for making an ajax call & json data parsing call.I'm not doing pagination or filter using datatables.
I would like to restrict the user from triggering the sort on other column when sort is still processing.(I even dont want to shift the image icon (up or down) to other column.
Below is my code.
[code]
var oTable= $('#userTable').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bProcessing": false,
"bSortable": true,
"bInfo": false,
"bAutoWidth": false,
"aoColumns": [{
"bSortable": false
}, //checkbox
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ] },
{ "asSorting": [ "desc", "asc" ] },
{
"bSortable": false //Status
}],
aaSorting: [[2, 'desc']],
"bServerSide": true,
"sAjaxSource": "/account/UserLists",
"fnServerData": function(sSource, aoData, fnCallback){
var initLoad = true;
if (typeof sortIndex != 'undefined' || typeof sortOrder != 'undefined') {
initLoad = false;
}
//To get the selected column & order.
sortIndex = fnGetKey(aoData, "iSortCol_0");
sortOrder = fnGetKey(aoData, "sSortDir_0");
if (sortIndex == 2) {
sortIndex = 0;
}
else if (sortIndex != 0 && sortIndex != 1) {
sortIndex = sortIndex - 1;
}
if (sortOrder == "asc") {
sortOrder = 1;
}
else {
sortOrder = 0;
}
if (!initLoad) { //To avoid duplicate call on first load.
getResponse(userStatus, start, rows); //This function triggers the getJSON call & //displays the data after parsing.Not using the sAjaxSource & fncallback. Also using the custom processing icon & //text.
}
}
});
[/code]