Can I use the data found by the global search

Can I use the data found by the global search

TomBajzekTomBajzek Posts: 164Questions: 37Answers: 1

Is there a way for my program to access the results of a global search (i.e., using the search box)? What I want to do is to display images whose pointers are contained in the records of the result set of a search that the user does by entering something into the on-page global search box. I've found a lot of information about DataTables search but I don't think I've found how to do that.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    edited June 2018 Answer ✓

    Sounds like you want to use rows().data() with a selector-modifier of {search:'applied'}. You can use pluck() to get the particular column and toArray() if you want an array of data instead of an array of Datatables API objects.

    for example:
    table.rows({search:'applied'}).data().pluck('images').toArray();

    Assumes you have a column named "images".

    Kevin

This discussion has been closed.