Hiding/highlighting individual rows with per-row checkboxes

Hiding/highlighting individual rows with per-row checkboxes

krickkrick Posts: 8Questions: 1Answers: 0

I'm working with an existing DataTables page where the previous developer added a column with a checkbox for every row and uses jQuery to hide an individual row when the user checks the checkbox for that row. Similarly, there's a second column with a checkbox that highlights a row when the box is checked. The point of the page is to present a table of data and allow the user to hide and highlight rows before printing or generating an XLS or PDF. The problem is that the DataTable isn't aware of the rows being hidden, so those rows show up when using the Buttons library (copy, excel, pdf). Likewise, since the highlighting is done via jQuery, the highlighting doesn't display when using the Buttons library (copy, excel, pdf).

I think that what I need to do is change the implementation so that the hiding is being done using the DataTables filtering API, but I'm not sure where to start. And I'm thinking that the highlighting can be implemented using some kind of CSS conditional styling, but it needs to be driven from the DataTable side based on user interaction.

Any suggestions on where to start would be greatly appreciated.

Thank you for your time

Answers

  • krickkrick Posts: 8Questions: 1Answers: 0

    I figured out how to implement the show/hide of rows by using a hidden column. When the user checks a checkbox on a row, I modify the value in the hidden column and search to filter the row that the user checked.

    I'm still having trouble with the highlighting. It doesn't appear that styling transfers from the on-screen DataTable to any of the button outputs (print/excel/pdf).

This discussion has been closed.