jquery - how to get tablesorter to work if loading with getscript. -
i loading tablesorter using jquery .getscript.
woi_.loadeddatatables = false; $.getscript("//cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.22.1/js/jquery.tablesorter.min.js").done(function(script, textstatus ){ console.log("text status " + textstatus); woi_.loadeddatatables = true; }).fail(function(jqxhr, settings, exception){ console.log(jqxhr); });
later on have code checks if woi_.loadeddatatables true , calls sorttable if is.
woi_.functions.sorttable = function(el){ console.log(el); el.tablesorter(); } if(woi_.loadeddatatables){ woi_.functions.sorttable($("#userwidgetstats")); }
my text status success, script has loaded, if check in resources panel can see has loaded.
console.log(el) gives me jquery element length of 1.
the table has structure seems tablesorter looking - thead , tbody, thead tr , multiple th elements, tbody multiple tr. @ rate if there problem table structure expect raise other error.
so seems tablesorter doesn't loaded getscript. right?
Comments
Post a Comment