ufTable: access underlying tablesorter object?


#1

This might be a really obvious question, but what’s the correct syntax for accessing the underlying tablesorter object when using ufTable?

My table is set up with:

$("#widget-members").ufTable({
        dataUrl: site.uri.public + "/api/members",
        useLoadingTransition: site.uf_table.use_loading_transition
    });

I’m trying to use additional tablesorter events like updateAll, but not having much luck. I’ve tried:

$("#widget-members").trigger("updateAll", [ resort, callback ]);

as shown in the tablesorter docs but it doesn’t seem to be running.


#2

Looks like I need to target the actual table element – the #widget-members element is a wrapper div. This code is working:

$("#widget-members table").trigger("updateAll", [ resort, callback ]);

#3

More troubleshooting: some tablesorter functions seem even more picky – for clearTableBody to work I had to change the selector to be just the table element:

$.tablesorter.clearTableBody($("table#table-members"))