Some public methods now accept the table as a DOM element or jQuery object - see #243

This commit is contained in:
Mottie 2013-03-14 00:28:08 -05:00
parent 571f724bb1
commit e9ca100372

View File

@ -852,9 +852,10 @@
// *** Process table *** // *** Process table ***
// add processing indicator // add processing indicator
ts.isProcessing = function(table, toggle, $ths) { ts.isProcessing = function(table, toggle, $ths) {
var c = table.config, table = $(table);
var c = table[0].config,
// default to all headers // default to all headers
$h = $ths || $(table).find('.' + c.cssHeader); $h = $ths || table.find('.' + c.cssHeader);
if (toggle) { if (toggle) {
if (c.sortList.length > 0) { if (c.sortList.length > 0) {
// get headers from the sortList // get headers from the sortList
@ -884,10 +885,11 @@
}; };
ts.clearTableBody = function(table) { ts.clearTableBody = function(table) {
table.config.$tbodies.empty(); $(table)[0].config.$tbodies.empty();
}; };
ts.destroy = function(table, removeClasses, callback){ ts.destroy = function(table, removeClasses, callback){
table = $(table)[0];
if (!table.hasInitialized) { return; } if (!table.hasInitialized) { return; }
// remove all widgets // remove all widgets
ts.refreshWidgets(table, true, true); ts.refreshWidgets(table, true, true);
@ -1096,6 +1098,7 @@
}; };
ts.applyWidget = function(table, init) { ts.applyWidget = function(table, init) {
table = $(table)[0];
var c = table.config, var c = table.config,
wo = c.widgetOptions, wo = c.widgetOptions,
ws = c.widgets.sort().reverse(), // ensure that widgets are always applied in a certain order ws = c.widgets.sort().reverse(), // ensure that widgets are always applied in a certain order
@ -1127,6 +1130,7 @@
}; };
ts.refreshWidgets = function(table, doAll, dontapply) { ts.refreshWidgets = function(table, doAll, dontapply) {
table = $(table)[0]; // see issue #243
var i, c = table.config, var i, c = table.config,
cw = c.widgets, cw = c.widgets,
w = ts.widgets, l = w.length; w = ts.widgets, l = w.length;