Why would you ever need to go server side when you re-order columns or hide/show columns?!

Why would you ever need to go server side when you re-order columns or hide/show columns?!

jameshojamesho Posts: 5Questions: 0Answers: 0
edited November 2011 in Plug-ins
So I've noticed that when you turn on "bServerSide" = true, the two plugins ColVis and ColReorder will always do an AJAX request.

Why is that even necessary? The reordering or hiding/showing of columns doesn't affect the data - you should able to keep this client-side (and therefore fast for a preferable UI experience).

Even if there is a reason (which possibly sounds to me as an edge case) then perhaps an option to go server side or not for both plugins would be nice!

Any thoughts?

James

Replies

  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin
    This is a side effect of each plug-in calling the 'draw' function to have the table redrawn (in order to make sure all changes are taken account of). Because with server-side processing there is no concept of local data in DataTables (the server is the data store - actually that's not strictly true, but very close :-) ) then a redraw must go to the server to get the data on each draw.

    It would indeed be possible to manipulate the DOM to rearrange columns as needed, and do whatever recalculation is needed, but it would take a good bit of development effort to do. Unfortunately this is a tradeoff I've made at the moment to be able to push on with other development. This is certainly something to be looked at in future though, or for someone to contribute a patch for :-)

    Allan
This discussion has been closed.