Destroy will now maintain applied theme

with false flag set: $("table").trigger("destroy", [false]);
This commit is contained in:
Mottie 2014-04-10 07:22:23 -05:00
parent b8cdca396f
commit a0e5620c69
3 changed files with 16 additions and 8 deletions

View File

@ -5,7 +5,8 @@
.tablesorter-bootstrap {
width: 100%;
}
.tablesorter-bootstrap .tablesorter-header,
.tablesorter-bootstrap thead th,
.tablesorter-bootstrap thead td,
.tablesorter-bootstrap tfoot th,
.tablesorter-bootstrap tfoot td {
font: bold 14px/20px Arial, Sans-serif;

View File

@ -12,8 +12,10 @@
}
/* header */
.tablesorter-jui th,
.tablesorter-jui thead td {
.tablesorter-jui thead th,
.tablesorter-jui thead td,
.tablesorter-jui tfoot th,
.tablesorter-jui tfoot td {
position: relative;
background-repeat: no-repeat;
background-position: right center;
@ -21,12 +23,12 @@
font-weight: bold !important;
border-width: 1px !important;
text-align: left;
padding: 8px; /* wider than the icon */
}
.tablesorter-jui .header,
.tablesorter-jui .tablesorter-header {
cursor: pointer;
white-space: normal;
padding: 8px; /* wider than the icon */
}
.tablesorter-jui .tablesorter-header-inner {
padding-right: 20px;

View File

@ -1165,6 +1165,11 @@
$h = $t.find('thead:first'),
$r = $h.find('tr.' + ts.css.headerRow).removeClass(ts.css.headerRow + ' ' + c.cssHeaderRow),
$f = $t.find('tfoot:first > tr').children('th, td');
if (removeClasses === false && $.inArray('uitheme', c.widgets) >= 0) {
// reapply uitheme classes, in case we want to maintain appearance
$t.trigger('applyWidgetId', ['uitheme']);
$t.trigger('applyWidgetId', ['zebra']);
}
// remove widget added rows, just in case
$h.find('tr').not($r).remove();
// disable tablesorter
@ -1173,12 +1178,12 @@
.unbind('sortReset update updateAll updateRows updateCell addRows updateComplete sorton appendCache updateCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave keypress sortBegin sortEnd '.split(' ').join(c.namespace + ' '));
c.$headers.add($f)
.removeClass( [ts.css.header, c.cssHeader, c.cssAsc, c.cssDesc, ts.css.sortAsc, ts.css.sortDesc, ts.css.sortNone].join(' ') )
.removeAttr('data-column');
.removeAttr('data-column')
.removeAttr('aria-label')
.attr('aria-disabled', 'true');
$r.find(c.selectorSort).unbind('mousedown mouseup keypress '.split(' ').join(c.namespace + ' '));
ts.restoreHeaders(table);
if (removeClasses !== false) {
$t.removeClass(ts.css.table + ' ' + c.tableClass + ' tablesorter-' + c.theme);
}
$t.toggleClass(ts.css.table + ' ' + c.tableClass + ' tablesorter-' + c.theme, removeClasses === false);
// clear flag in case the plugin is initialized again
table.hasInitialized = false;
if (typeof callback === 'function') {