yadcf
yadcf copied to clipboard
yadcf_data not used if Datatables has already requested the data from the server
If YADCF is initialised after Datatables, the dropdowns only contain the values on the first page.
E.g. https://jsfiddle.net/7wv928xc/1/ only has "Red" in the second column's filter, but https://jsfiddle.net/7wv928xc/2/ correctly has "Blue" and "Green" in the list too.
Most of the time this isn't an issue, as DataTables is slow enough to initialise that YADCF adds the event handler before the first ajax request. However if YADCF is added sometime after Datatables is setup, or if Datatables is quick to initialise, then the event handler (below) is only added after the first ajax request (subsequent requests work fine).
$(document).off('xhr.dt', oTable.selector).on('xhr.dt', oTable.selector, function (e, settings, json) {
This is the Datatables problem.
You can call this.api().ajax.reload()
at the end of the init callback after yadcf initialization to make another request, which will be caught by yadcf.