RowVis like ColVis

RowVis like ColVis

nikoniko Posts: 5Questions: 0Answers: 0
edited January 2012 in Feature requests
Is there anyway I can hide and show rows just like ColVis functionality? http://datatables.net/extras/colvis/
Cheers.

Replies

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin
    The filtering ability in DataTables effectively provides this in the core. You just need to modify the applied filter to show/hide rows as required.

    Allan
  • nikoniko Posts: 5Questions: 0Answers: 0
    The filter field on the top right? Not so; it is not possible to hide one arbitrary row with arbitrary content. I was thinking maybe I could set the row's height to zero or somehow expand on row details.
  • jaygirijaygiri Posts: 1Questions: 0Answers: 0
    I would use fnRowCallback while loading data. OR addClass to the row i want to hide. This doesn't look like core feature of DataTables.
  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin
    To filter out a row you just need to make sure that your filtering criterion will cause that row and only that row to be removed. One way to do that is to have a hidden column which unique IDs and filter out those rows with IDs that you do not want (using a little bit of regex and a single column filter).

    The problem with removing rows using DOM methods or setting their height to zero is that if you have paging enabled and you hide 6 rows from a view, then your user will be expecting 10 rows (or whatever the page length is), but they would only see 4. Thus filtering is the built-in way to do this.

    Allan
This discussion has been closed.