jquery - Passing object and its methods to onchange function in Javascript -
i using tableexport.js script export html table, , need export data after i've filtered hiding rows don't want. tableexport's method .update() comes in useful here, having problems call every time data filtered, associated onchange event. here relevant pieces of code:
$(function () { var exportedtable = $("#tasklisttable").tableexport(); exportedtable.update({ // options }); $('body').on('change', '.filter', function (exportedtable) { // code filtering tableupdate(exportedtable); }); }) function tableupdate(table) { table.update({ ignorecss: ["tr.tableexport-ignore", "tr.tableexport-ignore>td", "tr.tableexport-ignore>th", "tr.hidden", "tr.hidden>td"] }); } i keep getting error of type uncaught typeerror: cannot read property 'update' of undefined. i've been reading lots of threads (like this: javascript passing object function) , other info understand difference between passing value , reference, more read , try more chaotic mind getting. can see failing in approach? - it's partly legacy code though, i'm open re-structure of if necessary.
i guess more problem of js misuse, hope question useful both people working tableexport , people similar js issues. summon thee, javascript jedis!
event handler functions called event object parameter. wanted access exportedtable scope, rather accepting argument.
Comments
Post a Comment