Is there a way to show only selected rows?

Is there a way to show only selected rows?

jLinuxjLinux Posts: 981Questions: 73Answers: 75

One of the tables im working with has the Select extension setup, and I have a little toolbar that adds some features to the table. I was wondering if there was a way to show only the rows that are selected in the table?

For example, say someone goes through any number of pages, and selects different rows on each one. Then they want to view the children on all of the selected rows. I wanted to basically filter the table so only the selected rows are visible, then show the child on each.

Is that possible? I dont see a way to search the table using a function, it looks like you have to use a string.

I know I could do something really cheesy like add an extra column and have the value of it change when the row gets selected/deselected, then search the table via that row.. But Im hoping theres a better way.

Thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin
    Answer ✓

    There isn't really a nice simple way of doing this at the moment. Rows are removed from the table by filtering, so you would need to use a custom search plug-in that would determine if the row should be included or not.

    This is something that should be a lot easier with the search improvements to the next major version of DataTables that I plan.

    Allan

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Thanks @allan. I thought of an idea for a plugin, some type of 'advanced search'.

    Basically, I think the issue with using the custom search feature is that you have to hardcode the column, and it gets the data out of an element, which makes it hard to use it with just a plugin that isnt based on inputs. I wanted to make it so you could execute range searches (and other types), and it would basically store the values in memory, then tweak the JS in the example to look at those values.

    What do you think

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    Already in planning :-)

  • user3770935user3770935 Posts: 10Questions: 4Answers: 0

    Hi @allan, has this feature been added to DataTables now?

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    No. It won't make it until the next major version.

    Allan

This discussion has been closed.