Can I use the data found by the global search

Can I use the data found by the global search

TomBajzekTomBajzek Posts: 74Questions: 13Answers: 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.

Answers

  • kthorngrenkthorngren Posts: 3,298Questions: 19Answers: 740
    edited June 13

    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

Sign In or Register to comment.