Toggle row visibility

Toggle row visibility

BSDGuruBSDGuru Posts: 5Questions: 2Answers: 0
edited May 17 in Free community support

I have a "collapse" like function which allows me to toggle the visibility of rows in a table, and I'm trying to get it to work with datatables. I've found a filter function when hiding the rows, but it seems to remove them from the table as I can't turn them back on.

Is there a way to simply display or not display rows without removing them from the dataset? without datatables I just add a class and remove it; but I can't get datatables to adjust the display and pagination on a redraw; it just shows fewer rows.

In other words, if I'm viewing 25 rows, and I add a display:none class, I only have 15 rows on the screen. Is there a way to have datatables ignore these rows without removing them from the dataset, so that I can unhide them without reloading?

Answers

  • BSDGuruBSDGuru Posts: 5Questions: 2Answers: 0

    I think I have this working using the search plugin api. I've read so many questions about this sort of thing; is there some reason datatables can't detect TRs that are hidden by css? It should be easy to determine if a row is forced hidden. It would really make things a lot easier on so many levels.

    I'm trying to avoid making the app datatables dependent, in case I have to remove it someday for some reason.

  • colincolin Posts: 6,181Questions: 0Answers: 1,060

    Hi @BSDGuru ,

    It just hasn't been done, as it wasn't a priority and not a key requirement for most users. The code is open-source, so if you feel like a challenge, take a pop!

    Cheers,

    Colin

  • BSDGuruBSDGuru Posts: 5Questions: 2Answers: 0

    I found something under 25K that works more to my liking and that doesn't crash and burn when a <td></td> is missing. I feel like I'm battling a beast with datatables; I prefer a filtering scheme that just hides rows that dont match. Datatables takes over the page and its just too cumbersome to do things that should be simple.

Sign In or Register to comment.