DT - Filtering callback
DT - Filtering callback
Hello,
In the previous version of DT I was using the following code:
oTable = $('#report').dataTable();
oTable.bind('filter', function () { filterChart(); })
function filterChart() {
oChart.series[0].setData(eval('[' + oTable.fnGetColumnData(1,true) + ']'), false);
oChart.series[1].setData(eval('[' + oTable.fnGetColumnData(3,true) + ']'), false);
oChart.redraw();
}
This was used to obtain the filtered columns to update a HighCharts graph. In the latest version the filterChart routine is never called. I am aware that much has changed in the new version, however I cannot find the equivilant method to accomplish this.
Using $('#report').on('search.dt', function () { filterChart(); }) it appears as though I would also have to handle the actual search/filtering operation as well?
Please forgive my ignorance, I'm sure I'm missing something obvious.
Answers
Hi,
The events that are triggered by 1.10 have been updated to include a namespace (
.dt
) in order to avoid conflict with other plug-ins that also trigger events (for exampledraw
is a common name for an event!).So using the
search.dt
event as you suggest is correct (search
is the new name, for consistency with the rest of the API).search
is identical to the oldfilter
event, so that should need to be the only change required.Allan