Change value of hidden column?

Change value of hidden column?

markstahlermarkstahler Posts: 15Questions: 0Answers: 0
edited August 2010 in General
I need to be able to change the value of a hidden column. Weird requirement? I am using it as a flag for sorting. If in a row is in a certain state, I use a hidden column to flag it and resort putting the flagged items at the bottom. What I need to be able to do is update the value in the hidden column but I am having trouble figuring out how. fnGetData() seems only to be able to retrieve data, it does not update the actual column data. I have been using fnGetNodes() extensively in this application but unfortunately when a column is hidden it doesnt show up in the list. This is the last obstacle to complete before my table is complete! Thanks for the fantastic plugin, Allan! I will definitely be donating shortly.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Best option is probably to use fnUpdate: http://datatables.net/api#fnUpdate . This API function takes column visibility into account and can be used for either individual cells or whole rows. There are other ways using the internal data structure of DataTables if that doesn't meet your requirements.

    Allan
  • markstahlermarkstahler Posts: 15Questions: 0Answers: 0
    Hi Allan, Thanks for the reply. Unfortunately the fnUpdate method is too slow for this application. You mentioned a way to use the internal data structures to do this. Can you point me in the right direction (again) please? Thanks!
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Did you try setting the fourth parameter (redraw) to false? That speeds it up hugely.

    To use the internal data strucutres, the best way of getting a grounding with this is to have a look at the fnUpdate source and see what requirements DataTables needs (update the node and the aData array for example).

    Allan
  • markstahlermarkstahler Posts: 15Questions: 0Answers: 0
    Hi Allan. Yesterday I was using the redraw parameter to false, it was still slow.

    Today I spent a good chunk of time playing with this. I noticed a fifth parameter, bAction that appears to rebuild the internal data structures. I set this parameter to false in the portion of my app that was very slow and it seems to have fixed the issue. Is this an undocumented feature?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Oops - not intentionally an undocumented feature! I had forgotten to update the documentation with this extra parameter, which was introduced in 1.7 beta 3. Thanks for picking it up and letting me know! The API docs have been updated now.

    Regards,
    Allan
This discussion has been closed.