How to get the filtered data on every change/update?
How to get the filtered data on every change/update?
Hi there!
I've a table and would like to send the filtered data to another script (php) that outputs a graph above the table.
I found the method fnGetDisplayNodes() but don't know how to use it the way I need. Everytime the filter gets changed I would like to update the graph with new data, is there any event like oTable.onUpdate(/* send displayed nodes to the graph-script */)?
Thanks in advance!
nerd1337
I've a table and would like to send the filtered data to another script (php) that outputs a graph above the table.
I found the method fnGetDisplayNodes() but don't know how to use it the way I need. Everytime the filter gets changed I would like to update the graph with new data, is there any event like oTable.onUpdate(/* send displayed nodes to the graph-script */)?
Thanks in advance!
nerd1337
This discussion has been closed.
Replies
if you're using server-side sourced data, you could send the JSON contents to some other routine to feed your graph, in the fnServerData routine. else you'll probably want to use fnGetNodes and fnGetData to fetch data from the filtered set and pass to your graph.
I'm using fnGetData and get the whole data, not just the filtered ones. I tried fnGetNodes but got no suitable solution, as well. Does anybody know how to get just the filtered data?
Thanks again!
I want the same functionality.
Did you even find a solution to this?
Thanks.
[code]
table.$('tr', {"filter": "applied"} );
[/code]
will get you a jQuery object with the TR elements that remain after the filter. From there you can loop over them using fnGetData.
There is also this API method that would do it: http://datatables.net/plug-ins/api#fnGetFilteredData
Allan