Search without drawing, then add results to another table

Search without drawing, then add results to another table

AshThorntonAshThornton Posts: 5Questions: 1Answers: 0

Hello,

I have an AJAX-based table (live events) that refreshes every 5 seconds (using setTimeout) from a data source that comes from PHP parsing an XML file.

The data updates constantly and I want to create an "alert" system so that when a user has applied filters to the table that is constantly updating, if the filters have made any matches in the data, add it to another DataTables instance.

The live events table already has many filters that the user can use. They are a mixture of text (regex) and numeric (range) filters.

The alerts filters need to be separate from any filters that have currently been applied to the live events table.

Is it possible to, each time the live events table refreshes, search the table with a set of filters, and access the results without redrawing the live events table, enabling me to add those results to a separate table?

I read on the search event (https://datatables.net/reference/event/search) page that "the search will be fired before the table has been redrawn with the updated filtered data, although the data will internally have been filtered." So this looks like it's possible to perhaps access that internally filtered data. Is that correct? If someone could point me in the right direction I'd be extremely grateful.

Thanks!

Answers

  • jelebjeleb Posts: 1Questions: 0Answers: 0

    Hi

    In your case, perhaps you can use the callback "drawCallback" ?

    But it is a good question

    If I want to have all values of my current table, is it possible to write something like :

    var table = $('#table').Datatable();
    var values = table.search().read();

    where read() is a json return search function ?

    Thanks

This discussion has been closed.