From 9bc24314edef79204579744d84f450f0d8dfcaee Mon Sep 17 00:00:00 2001 From: Mottie Date: Thu, 16 Jan 2014 17:16:56 -0600 Subject: [PATCH] Add storageKey to pager widget. Fixes #481 --- js/widgets/widget-pager.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/widgets/widget-pager.js b/js/widgets/widget-pager.js index ac1a82d7..64ecd25c 100644 --- a/js/widgets/widget-pager.js +++ b/js/widgets/widget-pager.js @@ -25,6 +25,9 @@ ts.addWidget({ // Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js) pager_savePages: true, + //defines custom storage key + pager_storageKey: 'tablesorter-pager', + // if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty // table row set to a height to compensate; default is false pager_fixedHeight: false, @@ -153,7 +156,7 @@ tsp = ts.pager = { ts.setFilters(table, p.currentFilters, false); } if (wo.pager_savePages && ts.storage) { - t = ts.storage(table, 'tablesorter-pager') || {}; // fixes #387 + t = ts.storage(table, wo.pager_storageKey) || {}; // fixes #387 p.page = isNaN(t.page) ? p.page : t.page; p.size = ( isNaN(t.size) ? p.size : t.size ) || 10; $.data(table, 'pagerLastSize', p.size); @@ -358,7 +361,7 @@ tsp = ts.pager = { c.$table.trigger('pagerComplete', c); // save pager info to storage if (wo.pager_savePages && ts.storage) { - ts.storage(table, 'tablesorter-pager', { + ts.storage(table, wo.pager_storageKey, { page : p.page, size : p.size }); @@ -760,7 +763,7 @@ tsp = ts.pager = { p.initialized = false; c.$table.unbind('destroy.pager sortEnd.pager filterEnd.pager enable.pager disable.pager'); if (ts.storage) { - ts.storage(table, 'tablesorter-pager', ''); + ts.storage(table, wo.pager_storageKey, ''); } },