diff --git a/docs/example-widget-pager.html b/docs/example-widget-pager.html index cd71a2eb..46cd338e 100644 --- a/docs/example-widget-pager.html +++ b/docs/example-widget-pager.html @@ -177,12 +177,10 @@ // Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs var $t = $(this); if (/Destroy/.test( $t.text() )){ - $table[0].config.widgets = ['zebra']; $table.trigger('destroyPager'); $t.text('Restore Pager'); } else { - $table[0].config.widgets = ['zebra', 'pager']; - $table.trigger('applyWidgets'); + $('table').trigger('applyWidgetId', 'pager'); $t.text('Destroy Pager'); } return false; @@ -233,6 +231,7 @@ NOTE!
applyWidgetId
to re-apply the pager widget after being destroyed.pageAndSize
method which allows setting both the pager page & size.{startRow:input}
and {page:input}
variables to the output
option.In v2.25.4, the direct method will now correctly accept $('table')
. Previously, only $('table')[0]
would work.
In v2.25.0, this method ensures that the widget initialization code is executed as well as the format function. So now a widget that was not previously initialized or had been previously removed, can be reapplied.
Only one widget can be applied at a time using this method.
$.tablesorter.applyWidgetId( $( 'table' ), 'zebra' );+
$.tablesorter.applyWidgetId( $('table'), 'zebra' );
$(function(){ // initialize tablesorter without the widget - $("table").tablesorter(); + $('table').tablesorter(); // click a button to apply the zebra striping - $("button").click(function(){ + $('button').click(function(){ $('table').trigger('applyWidgetId', 'zebra'); return false; }); @@ -5367,7 +5368,7 @@ $('table').trigger( 'search', [['', '', '', '', 'orange']] ); // find orange in$(function(){ $('table').trigger('destroyPager'); });- The only way to restore the pager is to re-initialize the pager addon + The only way to restore the pager addon is to re-initialize the pager addon:
$(function(){ $('table').tablesorterPager(pagerOptions); diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index b789e3b8..b786e369 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1902,6 +1902,7 @@ }, applyWidgetId : function( table, id, init ) { + table = $(table)[0]; var applied, time, name, c = table.config, wo = c.widgetOptions,