ColVis making unnecessary AJAX requests

ColVis making unnecessary AJAX requests

krojewkrojew Posts: 30Questions: 0Answers: 0
edited October 2010 in Bug reports
Hi,
When using ColVis with server-side processing, every show/hide toggle makes a request to the server with the same parameters instead of just hiding/showing a column.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    This is sort of intentional - when you show / hide columns with ColVis it needs to recalculate the column widths, and in order to do that it needs to do a redraw - hence the Ajax request. You are right that this is effectively redundant, but it's required as part of the process to get things "right". One option to stop this would be to use pipelining: http://datatables.net/examples/server_side/pipeline.html .

    Allan
  • krojewkrojew Posts: 30Questions: 0Answers: 0
    Pipelining seems to be a quite "heavy" workaround. In my opinion there should be some checking done inside DataTables, if a request is really necessary, or some configuration option at least. The problem is that, with SS processing, a draw request == a new data request, which should be decoupled. When filter/paging parameters don't change, a draw request should be just a draw request, not a request for (the same) data. I don't know if seperating these two is doable but it could avoid problems like this.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Here is a small plug-in API function that should basically do what is needed at the end of the draw (which is to match column widths etc) and this should mean that it is not strictly necessary to call the draw function:

    [code]
    $.fn.dataTableExt.oApi.fnDrawFunctions = function ( oSettings )
    {
    for ( var i=0, iLen=oSettings.aoDrawCallback.length ; i
This discussion has been closed.