Colvis calling to server

Colvis calling to server

ririckririck Posts: 11Questions: 0Answers: 0
edited February 2012 in General
I have an application with really many fields that are not always used because they hare hidden with ColVis plugin.
I see that the largest part of the size of my page is the JSON response from the server (like 2mb).
I think it would be useful to have a callback to the server when the show/hide colum is done for just asking the data of the columns that are really displayed.
I do not know if this is a good idea but having this option could reduce the size of the data retrived.
It would also be useful to remember the actual columns between page refresh

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Its an interesting option. Discontinuous data for columns like that isn't something I've thought about implementing for DataTables before - I've always assumed that the data for the whole row would be available, but I can see that it might be useful on larger tables.

    I'll consider this for a future release - thanks for the suggestion!

    Allan
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Actually I should say that to some extent this can already be done with 1.9 - set the sDefaultContent for a column and then just don't return the field for that column - the default content would be used. Then when you do want to get the data for that column you would need to request it form the server and use fnUpdate to tell DataTables about the "new" data.

    Allan
  • ririckririck Posts: 11Questions: 0Answers: 0
    Thanks, are there some kind of events fired when a ColVis checkbox is checked or unchecked? Are the checked columns passed to the event? I could fire callback to the server to refresh the data on that.
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    > Thanks, are there some kind of events fired when a ColVis checkbox is checked or unchecked?

    Currently no - but firing a 'columnVisibility' event sounds like a good option. At the moment the closest is to bind your own events to the buttons in the ColVis list, which will work okay since the events are allowed to bubble - I'd suggest using a 'live' event handler rather than a static one! That way you will know when the column visibility is triggered.

    Allan
This discussion has been closed.