SaveSort: Fix JS error. See #1525

This commit is contained in:
Rob Garrison 2018-03-19 06:24:05 -05:00
parent 745229d7ff
commit 38b0f90431
2 changed files with 9 additions and 4 deletions

View File

@ -16,7 +16,8 @@
<!-- Tablesorter: required -->
<link rel="stylesheet" href="../css/theme.blue.css">
<script src="../js/jquery.tablesorter.js"></script>
<script src="../js/jquery.tablesorter.widgets.js"></script>
<script src="../js/widgets/widget-storage.js"></script>
<script src="../js/widgets/widget-saveSort.js"></script>
<script src="../js/parsers/parser-ignore-articles.js"></script>
<script id="js">$(function() {
@ -26,7 +27,11 @@
theme: 'blue',
// use save sort widget
widgets: ["saveSort", "zebra"]
widgets: ["saveSort", "zebra"],
widgetOptions: {
// enable/disable saveSort dynamically
saveSort: true
}
});

View File

@ -1,4 +1,4 @@
/*! Widget: saveSort - updated 2018-03-18 (v2.30.0) *//*
/*! Widget: saveSort - updated 2018-03-19 (v2.30.1) *//*
* Requires tablesorter v2.16+
* by Rob Garrison
*/
@ -8,7 +8,7 @@
function getStoredSortList(c) {
var stored = ts.storage( c.table, 'tablesorter-savesort' );
return (stored && stored.hasOwnProperty('sortList') && $.isArray(stored.sortList)) ? stored.sortList : '';
return (stored && stored.hasOwnProperty('sortList') && $.isArray(stored.sortList)) ? stored.sortList : [];
}
function sortListChanged(c, sortList) {