Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yadcf_data not used if Datatables has already requested the data from the server #635

Open
mjl321 opened this issue Sep 21, 2020 · 1 comment

Comments

@mjl321
Copy link

mjl321 commented Sep 21, 2020

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) {

@dzaporozhchenko
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants