Change columnDefs and reload table

Change columnDefs and reload table

CouinCouin Posts: 12Questions: 4Answers: 0

Hi :)

I would dynamicaly changes columnDefs (hide or not some columns), and reload the table.

I use Serverside mode so I can not post the script I tried of live, but tried to write for client side :
http://live.datatables.net/wulomita/3/edit

But it does nothing :(

Any idea of how could I do ?

Thanks :)

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    You can't change columnDefs once the table is initialised, so you'll need to destroy the original table (with either destroy() or destroy) and initialise again. If you just want to hide columns, it would be worth looking at Buttons - see here,

    Colin

  • CouinCouin Posts: 12Questions: 4Answers: 0

    Hi Colin,

    Thanks for your answer.

    I would not use buttons in this project as well as :
    - The Column visibility button replace the page length selector
    - I use a first column that is hidden, to have the id of MySQL entry, because when I click on the table row ( DOM / jQuery events ), it displays the data modifications form. I don't want this id can be visible.
    - Some columns header are pictograms. The Colunm selector does not display anything else of text.
    - On I add dom: 'Bfrtip', in the parameters, I get no data (I probably doing something wrong or perhaps not compatible with serverside mode ?)

    But I keep this feat in my pocket :)

    The destroy option perfectly answered to my request :D

    Thanks !
    Couin

This discussion has been closed.