Update a column rendering function on the fly

Update a column rendering function on the fly

dasuldasul Posts: 2Questions: 1Answers: 0

Hello!

Is there a way to update a column rendering function of the dataTable on a .draw() without destroying the table ?
I'm using custom filters and would like to change the way the data is displayed depending on active filters and destroying the table is the only thing I found but it's not a viable solution for me.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736
    Answer ✓

    Destroying the table is the only way to change the config options.

    Maybe you can use if statements in the render function to determine the active filters and the desired render code to run.

    Kevin

  • dasuldasul Posts: 2Questions: 1Answers: 0

    The thing is the filters will be often active and the table generation takes ~2-3 seconds due to the volume of data so if I destroy and regenerate the table each time a filter is toggled it will ruin the user experience.

    I will see if I can manage to cheat around this, thanks for the confirmation!

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    This FAQ may help you increase the speed of the Datatables loading.

    Kevin

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @dasul ,

    This here may be what you're looking for. The columns.render function is conditionally checking the radio box and then displays the final column (a copy of the previous) depending upon the setting.

    Cheers,

    Colin

This discussion has been closed.