Setting table options with api (like scrollY)?

Setting table options with api (like scrollY)?

lucasexatolucasexato Posts: 3Questions: 2Answers: 0

Hi, can I change some of the initialization options of my table by calling the API?
I'm looking for ways to change "scrollY", "scollX" and "responsive".
Thank you a lot!

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,147Questions: 26Answers: 4,918
    Answer ✓

    In general most config options aren't changeable via the API. A few are but I don't believe the options you listed are. You can use destroy() or destroy to destroy the current Datatable then reinitialize with the new options.

    Kevin

  • lucasexatolucasexato Posts: 3Questions: 2Answers: 0

    It indeed works, however it seems that colReorder is broken: when I destroy and recriate the table at the same page, the columns data appear to consider the reorder, but the titles don't, even forcing a draw() some time after the creation.

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @lucasexato ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.