Why no fnGetColumnVis?

Why no fnGetColumnVis?

soichihsoichih Posts: 1Questions: 0Answers: 0
edited May 2010 in General
Hi.

I have a set of toggler buttons at the top of DataTables where user can show / hide various column by clicking on these toggle buttons. I was able to do this very easily thanks to fnSetColumnVis function. I have also noticed that show/hide states for each column is preserved via Cookie so that next time user opens the same page, he/she will see the same set of shown columns.

I can not, however, figure out a way to reset my toggle buttons state based on information stored in the cookie when user first opens the page. I can parse the Json stored in the cookie parameter "abVisCols" to get to this information, but the clearer way to implement this is to call something like "fnGetColumnVis" (and no such function exists) during initialization and reset the toggler.

Does this function not exist because other users are able to accomplish what I am trying to accomplish in a different way? Or should I request that this function to be added?

Thanks!
Soichi

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Soichi,

    It doesn't exist because I never really thought about it before :-). Probably a good one for a plug-in API function... ( http://datatables.net/development/api ). What you can do is loop over aoColumns (in the settings object) and check what bVisible is for each column. From that an array can be created with the current state of visibility.

    Regards,
    Allan
This discussion has been closed.