Dynamic button to hide/show rows

Dynamic button to hide/show rows

miltonbarbozamiltonbarboza Posts: 5Questions: 2Answers: 0

Hello,

I am trying to create a button collection to show or hide the rows that match that button content.
Using the datable example here), I want to create a button "Office Selection" that is a collection of the buttons "Tokyo", "London", "San Francisco", and so on.
Lets say that all the buttons but "London" are clicked by default (like the button "salary" in the example).
In that case the table will show all the data without the rows with London in the column office. If i click the button "London", it will show the content again.

So, what I want is something like the colvis button but using the data of a specific column.

Can anyone please help me?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,461Questions: 1Answers: 10,466 Site admin
    Answer ✓

    Row show and hide in DataTables is done via filtering. In this case you probably need to use a custom plug-in filter to fitler the data as you need (redraw the table from your button using draw() to trigger a refilter.

    Another option is to use a column filter - column().search(), or perhaps a UI widget such as this.

    Allan

  • miltonbarbozamiltonbarboza Posts: 5Questions: 2Answers: 0

    Thank you for the fast response, Allan.
    I am using the searchPane now and it is almost what I was looking for. I left a feedback on the searchPane feedback thread with the things that would improve the plugin and help me here.
    Thank you again.

This discussion has been closed.