berndy2001
berndy2001

Reputation: 66

datatables/yadcf with new api isn´t working with dom-onclick

I am using datatables, yadcf-plugin and exResetAllFilters to reset all column filters.

I recently switched to the "new api" (yadcf.init), but dom onclick isn´t working anymore. Error is:

Uncaught ReferenceError: table is not defined at HTMLInputElement.onclick

I know I can do it with $("#reset2").click, but I am interested to understand why isn´t working anymore.

For better explaination, I made two samples: http://live.datatables.net/yavayasa/2/edit and http://live.datatables.net/xofaluli/3/edit

Upvotes: 0

Views: 150

Answers (1)

Daniel
Daniel

Reputation: 37061

Its not related to yadcf, in that example you declared your table variable inside your $(document).ready( function () { function and since js var is lives inside teh function scope it will be undefined for calls made outside of that function,

Solution: declare your table variable outside the function, see example

var table;
$(document).ready( function () {
...

Upvotes: 0

Related Questions