1

I am using dataTable jquery plugin with server side processing enabled. While using fnReloadAjax function, there is a delay of 2-3 seconds between hiding of the processing div and display of the new data. Here is a post regarding this problem. I found out that this is due to multiple server requests made by datatable.

In my page onchange event of a set of radio buttons is making a call to server for new data as follows

oTable.fnReloadAjax("getCaseList?caseStatus=xxx&showValidOnly=true");

In the firebug console I see two requests being made one after the other

  1. GET https://localhost/getCaseList?caseStatus=xxx&showValidOnly=true&_=1363611652185
  2. GET https://localhost/getCaseList?caseStatus=xxx&showValidOnly=true&sEcho=4&iColumns=9&sColumns=&iDisplayStart=0&iDisplayLength=100&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=true&sSearch_6=&bRegex_6=false&bSearchable_6=true&sSearch_7=&bRegex_7=false&bSearchable_7=true&sSearch_8=&bRegex_8=false&bSearchable_8=true&iSortingCols=1&iSortCol_0=4&sSortDir_0=desc&bSortable_0=false&bSortable_1=true&bSortable_2=true&bSortable_3=true&bSortable_4=true&bSortable_5=true&bSortable_6=true&bSortable_7=true&bSortable_8=true&_=1363611701804

The processing div is getting hidden after the completion of first request but new data is loaded only after the second request is complete.

Why is datatable making that second extra call?

2 Answers 2

1

I have been running into the same problem. In my case also i have been using server side processing. After the datatable was initialized, I had written the below statements to hide some columns

tableExample.fnSetColumnVis(5, false);
tableExample.fnSetColumnVis(6, false);
tableExample.fnSetColumnVis(3, false);

And I realized it was requesting 4 times. Then I removed these lines and the the problem of multiple request was solved in my case. How ever if you want to still hide the columns, there is another approach by adding a class ('sClass':'hidden') which sets "display:none" to the column in the column definition of datatable.

  aoColumnDefs: [
        { "bSortable": true, "aTargets": [0] },
        { "bSortable": true, "aTargets": [1] },
        { "bSortable": false, "aTargets": [2] },
        { "bSortable": true, "aTargets": [3] },
        { "bSortable": true, "aTargets": [4] },
       { "bSortable": true, "aTargets": [5], "sClass": "hidden" },
        { "bSortable": true, "aTargets": [6], "sClass": "hidden" },
        { "bSortable": false, "aTargets": [7] },
        { "bSortable": false, "aTargets": [8] },
        { "bSortable": false, "aTargets": [9], "sClass": "hidden" }         

      ]

Hope this helps. Thanks

Sign up to request clarification or add additional context in comments.

Comments

0

Server side requests are issued by the internal _fnAjaxUpdate function, which is called from _fnDraw.

This means you are probably calling some method that needs to redraw the table, like a sort or a search, which issues that additional request.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.