mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Global: removed c.$extraTables & c.$extraHeaders
These variables were causing memory leaks
This commit is contained in:
parent
6a22785593
commit
c82280e598
10
dist/js/jquery.tablesorter.js
vendored
10
dist/js/jquery.tablesorter.js
vendored
@ -559,7 +559,9 @@
|
|||||||
cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
||||||
aria = ['ascending', 'descending'],
|
aria = ['ascending', 'descending'],
|
||||||
// find the footer
|
// find the footer
|
||||||
$t = $(table).find('tfoot tr').children().add(c.$extraHeaders).removeClass(css.join(' '));
|
$t = $(table).find('tfoot tr').children()
|
||||||
|
.add( $( c.namespace + '_extra_headers' ) )
|
||||||
|
.removeClass( css.join( ' ' ) );
|
||||||
// remove all header information
|
// remove all header information
|
||||||
c.$headers
|
c.$headers
|
||||||
.removeClass(css.join(' '))
|
.removeClass(css.join(' '))
|
||||||
@ -1337,10 +1339,10 @@
|
|||||||
var t, downTarget = null,
|
var t, downTarget = null,
|
||||||
c = table.config;
|
c = table.config;
|
||||||
if (core !== true) {
|
if (core !== true) {
|
||||||
c.$extraHeaders = c.$extraHeaders ? c.$extraHeaders.add($headers) : $headers;
|
$headers.addClass( c.namespace.slice(1) + '_extra_headers' );
|
||||||
t = $.fn.closest ? $headers.closest('table')[0] : $headers.parents('table')[0];
|
t = $.fn.closest ? $headers.closest('table')[0] : $headers.parents('table')[0];
|
||||||
if (t && t.nodeName === 'TABLE' && t !== table) {
|
if (t && t.nodeName === 'TABLE' && t !== table) {
|
||||||
c.$extraTables = c.$extraTables ? c.$extraTables.add(t) : $(t);
|
$(t).addClass( c.namespace.slice(1) + '_extra_table' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// apply event handling to headers and/or additional headers (stickyheaders, scroller, etc)
|
// apply event handling to headers and/or additional headers (stickyheaders, scroller, etc)
|
||||||
@ -2057,7 +2059,7 @@
|
|||||||
format: function(table, c, wo) {
|
format: function(table, c, wo) {
|
||||||
var $tb, $tv, $tr, row, even, time, k,
|
var $tb, $tv, $tr, row, even, time, k,
|
||||||
child = new RegExp(c.cssChildRow, 'i'),
|
child = new RegExp(c.cssChildRow, 'i'),
|
||||||
b = c.$tbodies.add( c.$extraTables && c.$extraTables.children( 'tbody' ) );
|
b = c.$tbodies.add( $( c.namespace + '_extra_table' ).children( 'tbody' ) );
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
time = new Date();
|
time = new Date();
|
||||||
}
|
}
|
||||||
|
4
dist/js/jquery.tablesorter.min.js
vendored
4
dist/js/jquery.tablesorter.min.js
vendored
File diff suppressed because one or more lines are too long
20
dist/js/jquery.tablesorter.widgets.js
vendored
20
dist/js/jquery.tablesorter.widgets.js
vendored
@ -1,4 +1,4 @@
|
|||||||
/*! tablesorter (FORK) widgets - updated 03-24-2015 (v2.21.2)*/
|
/*! tablesorter (FORK) widgets - updated 03-25-2015 (v2.21.2)*/
|
||||||
/* Includes: storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort */
|
/* Includes: storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort */
|
||||||
(function(factory) {
|
(function(factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
@ -147,8 +147,8 @@ ts.addWidget({
|
|||||||
format: function(table, c, wo) {
|
format: function(table, c, wo) {
|
||||||
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
||||||
themesAll = ts.themes,
|
themesAll = ts.themes,
|
||||||
$table = c.$table.add( c.$extraTables ),
|
$table = c.$table.add( $( c.namespace + '_extra_table' ) ),
|
||||||
$headers = c.$headers.add( c.$extraHeaders ),
|
$headers = c.$headers.add( $( c.namespace + '_extra_headers' ) ),
|
||||||
theme = c.theme || 'jui',
|
theme = c.theme || 'jui',
|
||||||
themes = themesAll[theme] || {},
|
themes = themesAll[theme] || {},
|
||||||
remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
|
remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
|
||||||
@ -219,7 +219,10 @@ ts.addWidget({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < c.columns; i++) {
|
for (i = 0; i < c.columns; i++) {
|
||||||
$header = c.$headers.add(c.$extraHeaders).not('.sorter-false').filter('[data-column="' + i + '"]');
|
$header = c.$headers
|
||||||
|
.add($(c.namespace + '_extra_headers'))
|
||||||
|
.not('.sorter-false')
|
||||||
|
.filter('[data-column="' + i + '"]');
|
||||||
$icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
|
$icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
|
||||||
$h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
|
$h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
|
||||||
if ($h.length) {
|
if ($h.length) {
|
||||||
@ -1769,7 +1772,7 @@ ts.addWidget({
|
|||||||
nestedStickyTop = $nestedSticky.length ? $nestedSticky.height() : 0,
|
nestedStickyTop = $nestedSticky.length ? $nestedSticky.height() : 0,
|
||||||
// clone table, then wrap to make sticky header
|
// clone table, then wrap to make sticky header
|
||||||
$stickyTable = wo.$sticky = $table.clone()
|
$stickyTable = wo.$sticky = $table.clone()
|
||||||
.addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders)
|
.addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders + ' ' + c.namespace.slice(1) + '_extra_table' )
|
||||||
.wrap('<div class="' + ts.css.stickyWrap + '">'),
|
.wrap('<div class="' + ts.css.stickyWrap + '">'),
|
||||||
$stickyWrap = $stickyTable.parent()
|
$stickyWrap = $stickyTable.parent()
|
||||||
.addClass(ts.css.stickyHide)
|
.addClass(ts.css.stickyHide)
|
||||||
@ -1827,13 +1830,6 @@ ts.addWidget({
|
|||||||
if ($attach.length && !$attach.css('position')) {
|
if ($attach.length && !$attach.css('position')) {
|
||||||
$attach.css('position', 'relative');
|
$attach.css('position', 'relative');
|
||||||
}
|
}
|
||||||
// save stickyTable element to config
|
|
||||||
// it is also saved to wo.$sticky
|
|
||||||
if (c.$extraTables && c.$extraTables.length) {
|
|
||||||
c.$extraTables.add($stickyTable);
|
|
||||||
} else {
|
|
||||||
c.$extraTables = $stickyTable;
|
|
||||||
}
|
|
||||||
// fix clone ID, if it exists - fixes #271
|
// fix clone ID, if it exists - fixes #271
|
||||||
if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
|
if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
|
||||||
// clear out cloned table, except for sticky header
|
// clear out cloned table, except for sticky header
|
||||||
|
6
dist/js/jquery.tablesorter.widgets.min.js
vendored
6
dist/js/jquery.tablesorter.widgets.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-stickyHeaders.min.js
vendored
2
dist/js/widgets/widget-stickyHeaders.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-uitheme.min.js
vendored
2
dist/js/widgets/widget-uitheme.min.js
vendored
@ -1,2 +1,2 @@
|
|||||||
/*! Widget: uitheme */
|
/*! Widget: uitheme */
|
||||||
!function(a){"use strict";var b=a.tablesorter=a.tablesorter||{};b.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",iconSortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"ui-widget-content",header:"ui-widget-header ui-corner-all ui-state-default",sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",hover:"ui-state-hover",icons:"ui-icon",iconSortNone:"ui-icon-carat-2-n-s",iconSortAsc:"ui-icon-carat-1-n",iconSortDesc:"ui-icon-carat-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}},a.extend(b.css,{wrapper:"tablesorter-wrapper"}),b.addWidget({id:"uitheme",priority:10,format:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r=b.themes,s=d.$table.add(d.$extraTables),t=d.$headers.add(d.$extraHeaders),u=d.theme||"jui",v=r[u]||{},w=a.trim([v.sortNone,v.sortDesc,v.sortAsc,v.active].join(" ")),x=a.trim([v.iconSortNone,v.iconSortDesc,v.iconSortAsc].join(" "));for(d.debug&&(i=new Date),s.hasClass("tablesorter-"+u)&&d.theme===d.appliedTheme&&e.uitheme_applied||(e.uitheme_applied=!0,n=r[d.appliedTheme]||{},q=!a.isEmptyObject(n),o=q?[n.sortNone,n.sortDesc,n.sortAsc,n.active].join(" "):"",p=q?[n.iconSortNone,n.iconSortDesc,n.iconSortAsc].join(" "):"",q&&(e.zebra[0]=a.trim(" "+e.zebra[0].replace(" "+n.even,"")),e.zebra[1]=a.trim(" "+e.zebra[1].replace(" "+n.odd,"")),d.$tbodies.children().removeClass([n.even,n.odd].join(" "))),v.even&&(e.zebra[0]+=" "+v.even),v.odd&&(e.zebra[1]+=" "+v.odd),s.children("caption").removeClass(n.caption||"").addClass(v.caption),l=s.removeClass((d.appliedTheme?"tablesorter-"+(d.appliedTheme||""):"")+" "+(n.table||"")).addClass("tablesorter-"+u+" "+(v.table||"")).children("tfoot"),d.appliedTheme=d.theme,l.length&&l.children("tr").removeClass(n.footerRow||"").addClass(v.footerRow).children("th, td").removeClass(n.footerCells||"").addClass(v.footerCells),t.removeClass((q?[n.header,n.hover,o].join(" "):"")||"").addClass(v.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(b){a(this)["mouseenter"===b.type?"addClass":"removeClass"](v.hover||"")}),t.each(function(){var c=a(this);c.find("."+b.css.wrapper).length||c.wrapInner('<div class="'+b.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>')}),d.cssIcon&&t.find("."+b.css.icon).removeClass(q?[n.icons,p].join(" "):"").addClass(v.icons||""),s.hasClass("hasFilters")&&s.children("thead").children("."+b.css.filterRow).removeClass(q?n.filterRow||"":"").addClass(v.filterRow||"")),f=0;f<d.columns;f++)j=d.$headers.add(d.$extraHeaders).not(".sorter-false").filter('[data-column="'+f+'"]'),k=b.css.icon?j.find("."+b.css.icon):a(),m=t.not(".sorter-false").filter('[data-column="'+f+'"]:last'),m.length&&(j.removeClass(w),k.removeClass(x),m[0].sortDisabled?k.removeClass(v.icons||""):(g=v.sortNone,h=v.iconSortNone,m.hasClass(b.css.sortAsc)?(g=[v.sortAsc,v.active].join(" "),h=v.iconSortAsc):m.hasClass(b.css.sortDesc)&&(g=[v.sortDesc,v.active].join(" "),h=v.iconSortDesc),j.addClass(g),k.addClass(h||"")));d.debug&&b.benchmark("Applying "+u+" theme",i)},remove:function(a,c,d,e){if(d.uitheme_applied){var f=c.$table,g=c.appliedTheme||"jui",h=b.themes[g]||b.themes.jui,i=f.children("thead").children(),j=h.sortNone+" "+h.sortDesc+" "+h.sortAsc,k=h.iconSortNone+" "+h.iconSortDesc+" "+h.iconSortAsc;f.removeClass("tablesorter-"+g+" "+h.table),d.uitheme_applied=!1,e||(f.find(b.css.header).removeClass(h.header),i.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(h.hover+" "+j+" "+h.active).filter("."+b.css.filterRow).removeClass(h.filterRow),i.find("."+b.css.icon).removeClass(h.icons+" "+k))}}})}(jQuery);
|
!function(a){"use strict";var b=a.tablesorter=a.tablesorter||{};b.themes={bootstrap:{table:"table table-bordered table-striped",caption:"caption",header:"bootstrap-header",sortNone:"",sortAsc:"",sortDesc:"",active:"",hover:"",icons:"",iconSortNone:"bootstrap-icon-unsorted",iconSortAsc:"icon-chevron-up glyphicon glyphicon-chevron-up",iconSortDesc:"icon-chevron-down glyphicon glyphicon-chevron-down",filterRow:"",footerRow:"",footerCells:"",even:"",odd:""},jui:{table:"ui-widget ui-widget-content ui-corner-all",caption:"ui-widget-content",header:"ui-widget-header ui-corner-all ui-state-default",sortNone:"",sortAsc:"",sortDesc:"",active:"ui-state-active",hover:"ui-state-hover",icons:"ui-icon",iconSortNone:"ui-icon-carat-2-n-s",iconSortAsc:"ui-icon-carat-1-n",iconSortDesc:"ui-icon-carat-1-s",filterRow:"",footerRow:"",footerCells:"",even:"ui-widget-content",odd:"ui-state-default"}},a.extend(b.css,{wrapper:"tablesorter-wrapper"}),b.addWidget({id:"uitheme",priority:10,format:function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q,r=b.themes,s=d.$table.add(a(d.namespace+"_extra_table")),t=d.$headers.add(a(d.namespace+"_extra_headers")),u=d.theme||"jui",v=r[u]||{},w=a.trim([v.sortNone,v.sortDesc,v.sortAsc,v.active].join(" ")),x=a.trim([v.iconSortNone,v.iconSortDesc,v.iconSortAsc].join(" "));for(d.debug&&(i=new Date),s.hasClass("tablesorter-"+u)&&d.theme===d.appliedTheme&&e.uitheme_applied||(e.uitheme_applied=!0,n=r[d.appliedTheme]||{},q=!a.isEmptyObject(n),o=q?[n.sortNone,n.sortDesc,n.sortAsc,n.active].join(" "):"",p=q?[n.iconSortNone,n.iconSortDesc,n.iconSortAsc].join(" "):"",q&&(e.zebra[0]=a.trim(" "+e.zebra[0].replace(" "+n.even,"")),e.zebra[1]=a.trim(" "+e.zebra[1].replace(" "+n.odd,"")),d.$tbodies.children().removeClass([n.even,n.odd].join(" "))),v.even&&(e.zebra[0]+=" "+v.even),v.odd&&(e.zebra[1]+=" "+v.odd),s.children("caption").removeClass(n.caption||"").addClass(v.caption),l=s.removeClass((d.appliedTheme?"tablesorter-"+(d.appliedTheme||""):"")+" "+(n.table||"")).addClass("tablesorter-"+u+" "+(v.table||"")).children("tfoot"),d.appliedTheme=d.theme,l.length&&l.children("tr").removeClass(n.footerRow||"").addClass(v.footerRow).children("th, td").removeClass(n.footerCells||"").addClass(v.footerCells),t.removeClass((q?[n.header,n.hover,o].join(" "):"")||"").addClass(v.header).not(".sorter-false").unbind("mouseenter.tsuitheme mouseleave.tsuitheme").bind("mouseenter.tsuitheme mouseleave.tsuitheme",function(b){a(this)["mouseenter"===b.type?"addClass":"removeClass"](v.hover||"")}),t.each(function(){var c=a(this);c.find("."+b.css.wrapper).length||c.wrapInner('<div class="'+b.css.wrapper+'" style="position:relative;height:100%;width:100%"></div>')}),d.cssIcon&&t.find("."+b.css.icon).removeClass(q?[n.icons,p].join(" "):"").addClass(v.icons||""),s.hasClass("hasFilters")&&s.children("thead").children("."+b.css.filterRow).removeClass(q?n.filterRow||"":"").addClass(v.filterRow||"")),f=0;f<d.columns;f++)j=d.$headers.add(a(d.namespace+"_extra_headers")).not(".sorter-false").filter('[data-column="'+f+'"]'),k=b.css.icon?j.find("."+b.css.icon):a(),m=t.not(".sorter-false").filter('[data-column="'+f+'"]:last'),m.length&&(j.removeClass(w),k.removeClass(x),m[0].sortDisabled?k.removeClass(v.icons||""):(g=v.sortNone,h=v.iconSortNone,m.hasClass(b.css.sortAsc)?(g=[v.sortAsc,v.active].join(" "),h=v.iconSortAsc):m.hasClass(b.css.sortDesc)&&(g=[v.sortDesc,v.active].join(" "),h=v.iconSortDesc),j.addClass(g),k.addClass(h||"")));d.debug&&b.benchmark("Applying "+u+" theme",i)},remove:function(a,c,d,e){if(d.uitheme_applied){var f=c.$table,g=c.appliedTheme||"jui",h=b.themes[g]||b.themes.jui,i=f.children("thead").children(),j=h.sortNone+" "+h.sortDesc+" "+h.sortAsc,k=h.iconSortNone+" "+h.iconSortDesc+" "+h.iconSortAsc;f.removeClass("tablesorter-"+g+" "+h.table),d.uitheme_applied=!1,e||(f.find(b.css.header).removeClass(h.header),i.unbind("mouseenter.tsuitheme mouseleave.tsuitheme").removeClass(h.hover+" "+j+" "+h.active).filter("."+b.css.filterRow).removeClass(h.filterRow),i.find("."+b.css.icon).removeClass(h.icons+" "+k))}}})}(jQuery);
|
@ -5500,34 +5500,6 @@ $('.tablesorter')[0].config.cache[0].normalized[0];
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr id="variable-extra-headers">
|
|
||||||
<td><a href="#" class="permalink">config.$extraHeaders</a></td>
|
|
||||||
<td>jQuery Object</td>
|
|
||||||
<td>Internal list of <strong>all</strong> extra table header cells (<span class="version">v2.16.2</span>)
|
|
||||||
<div class="collapsible">
|
|
||||||
<br>
|
|
||||||
When the <a href="#function-bindevents"><code>bindEvents</code></a> function is used, the extra (external) header cells are added to this variable, and automatically updated with the table headers (<a href="#variable-headers"><code>config.$headers</code></a>).<br>
|
|
||||||
<br>
|
|
||||||
So, when writing a custom widget that clones the table header, there is no longer a need to update the header class names, it's all done automatically.
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr id="variable-extra-tables">
|
|
||||||
<td><a href="#" class="permalink">config.$extraTables</a></td>
|
|
||||||
<td>jQuery Object</td>
|
|
||||||
<td>Internal list of <strong>all</strong> extra (cloned) table elements (<span class="version">v2.19.0</span>)
|
|
||||||
<div class="collapsible">
|
|
||||||
<br>
|
|
||||||
Some widgets need to duplicate parts of the original table to provide functionality (e.g. stickyHeaders, scroller). This saved variable will either not exist or contain a jQuery object pointing to the cloned table elements.<br>
|
|
||||||
<br>
|
|
||||||
This variable was added for the uitheme widget to allow dynamic updating of themes to the original table as well as all cloned parts.
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr id="variable-header-indexed">
|
<tr id="variable-header-indexed">
|
||||||
<td><a href="#" class="permalink">config.$headerIndexed</a></td>
|
<td><a href="#" class="permalink">config.$headerIndexed</a></td>
|
||||||
<td>Array</td>
|
<td>Array</td>
|
||||||
@ -5983,6 +5955,43 @@ $.each( p.cacheIndex, function(i, v) {
|
|||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
||||||
|
<!-- non-sorting tbody -->
|
||||||
|
<tbody id="pager-removed" class="tablesorter-infoOnly">
|
||||||
|
<tr><th colspan="5">Removed Variables</th></tr>
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr id="variable-extra-headers">
|
||||||
|
<td><a href="#" class="permalink alert">config.$extraHeaders</a></td>
|
||||||
|
<td>jQuery Object</td>
|
||||||
|
<td>Internal list of <strong>all</strong> extra table header cells (<span class="version">v2.16.2</span>; <span class="label label-danger">removed</span> v2.21.3)
|
||||||
|
<div class="collapsible">
|
||||||
|
<p>This variable was removed due to it causing memory leak issues. To now find extra headers use <a href="#namespace"><code>config.namespace</code></a> as follows:</p>
|
||||||
|
<pre class="prettyprint lang-js">$( config.namespace + '_extra_headers' )</pre>
|
||||||
|
<p>When the <a href="#function-bindevents"><code>bindEvents</code></a> function is used, the extra (external) header cells are added to this variable, and automatically updated with the table headers (<a href="#variable-headers"><code>config.$headers</code></a>).</p>
|
||||||
|
<p>So, when writing a custom widget that clones the table header, there is no longer a need to update the header class names, it's all done automatically.</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr id="variable-extra-tables">
|
||||||
|
<td><a href="#" class="permalink alert">config.$extraTables</a></td>
|
||||||
|
<td>jQuery Object</td>
|
||||||
|
<td>Internal list of <strong>all</strong> extra (cloned) table elements (<span class="version">v2.19.0</span>; <span class="label label-danger">removed</span> v2.21.3)
|
||||||
|
<div class="collapsible">
|
||||||
|
<p>This variable was removed due to it causing memory leak issues. To find extra tables use <a href="#namespace"><code>config.namespace</code></a> as follows:</p>
|
||||||
|
<pre class="prettyprint lang-js">$( config.namespace + '_extra_table' )</pre>
|
||||||
|
<p>Some widgets need to duplicate parts of the original table to provide functionality (e.g. stickyHeaders, scroller). This saved variable will either not exist or contain a jQuery object pointing to the cloned table elements.</p>
|
||||||
|
<p>This variable was added for the uitheme widget to allow dynamic updating of themes to the original table as well as all cloned parts.</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="tip">
|
<div class="tip">
|
||||||
|
@ -559,7 +559,9 @@
|
|||||||
cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
cssIcon = [ c.cssIconAsc, c.cssIconDesc, c.cssIconNone ],
|
||||||
aria = ['ascending', 'descending'],
|
aria = ['ascending', 'descending'],
|
||||||
// find the footer
|
// find the footer
|
||||||
$t = $(table).find('tfoot tr').children().add(c.$extraHeaders).removeClass(css.join(' '));
|
$t = $(table).find('tfoot tr').children()
|
||||||
|
.add( $( c.namespace + '_extra_headers' ) )
|
||||||
|
.removeClass( css.join( ' ' ) );
|
||||||
// remove all header information
|
// remove all header information
|
||||||
c.$headers
|
c.$headers
|
||||||
.removeClass(css.join(' '))
|
.removeClass(css.join(' '))
|
||||||
@ -1337,10 +1339,10 @@
|
|||||||
var t, downTarget = null,
|
var t, downTarget = null,
|
||||||
c = table.config;
|
c = table.config;
|
||||||
if (core !== true) {
|
if (core !== true) {
|
||||||
c.$extraHeaders = c.$extraHeaders ? c.$extraHeaders.add($headers) : $headers;
|
$headers.addClass( c.namespace.slice(1) + '_extra_headers' );
|
||||||
t = $.fn.closest ? $headers.closest('table')[0] : $headers.parents('table')[0];
|
t = $.fn.closest ? $headers.closest('table')[0] : $headers.parents('table')[0];
|
||||||
if (t && t.nodeName === 'TABLE' && t !== table) {
|
if (t && t.nodeName === 'TABLE' && t !== table) {
|
||||||
c.$extraTables = c.$extraTables ? c.$extraTables.add(t) : $(t);
|
$(t).addClass( c.namespace.slice(1) + '_extra_table' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// apply event handling to headers and/or additional headers (stickyheaders, scroller, etc)
|
// apply event handling to headers and/or additional headers (stickyheaders, scroller, etc)
|
||||||
@ -2057,7 +2059,7 @@
|
|||||||
format: function(table, c, wo) {
|
format: function(table, c, wo) {
|
||||||
var $tb, $tv, $tr, row, even, time, k,
|
var $tb, $tv, $tr, row, even, time, k,
|
||||||
child = new RegExp(c.cssChildRow, 'i'),
|
child = new RegExp(c.cssChildRow, 'i'),
|
||||||
b = c.$tbodies.add( c.$extraTables && c.$extraTables.children( 'tbody' ) );
|
b = c.$tbodies.add( $( c.namespace + '_extra_table' ).children( 'tbody' ) );
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
time = new Date();
|
time = new Date();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀▀██
|
||||||
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
||||||
*/
|
*/
|
||||||
/*! tablesorter (FORK) widgets - updated 03-24-2015 (v2.21.2)*/
|
/*! tablesorter (FORK) widgets - updated 03-25-2015 (v2.21.2)*/
|
||||||
/* Includes: storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort */
|
/* Includes: storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort */
|
||||||
(function(factory) {
|
(function(factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
@ -153,8 +153,8 @@ ts.addWidget({
|
|||||||
format: function(table, c, wo) {
|
format: function(table, c, wo) {
|
||||||
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
||||||
themesAll = ts.themes,
|
themesAll = ts.themes,
|
||||||
$table = c.$table.add( c.$extraTables ),
|
$table = c.$table.add( $( c.namespace + '_extra_table' ) ),
|
||||||
$headers = c.$headers.add( c.$extraHeaders ),
|
$headers = c.$headers.add( $( c.namespace + '_extra_headers' ) ),
|
||||||
theme = c.theme || 'jui',
|
theme = c.theme || 'jui',
|
||||||
themes = themesAll[theme] || {},
|
themes = themesAll[theme] || {},
|
||||||
remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
|
remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
|
||||||
@ -225,7 +225,10 @@ ts.addWidget({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < c.columns; i++) {
|
for (i = 0; i < c.columns; i++) {
|
||||||
$header = c.$headers.add(c.$extraHeaders).not('.sorter-false').filter('[data-column="' + i + '"]');
|
$header = c.$headers
|
||||||
|
.add($(c.namespace + '_extra_headers'))
|
||||||
|
.not('.sorter-false')
|
||||||
|
.filter('[data-column="' + i + '"]');
|
||||||
$icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
|
$icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
|
||||||
$h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
|
$h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
|
||||||
if ($h.length) {
|
if ($h.length) {
|
||||||
@ -1775,7 +1778,7 @@ ts.addWidget({
|
|||||||
nestedStickyTop = $nestedSticky.length ? $nestedSticky.height() : 0,
|
nestedStickyTop = $nestedSticky.length ? $nestedSticky.height() : 0,
|
||||||
// clone table, then wrap to make sticky header
|
// clone table, then wrap to make sticky header
|
||||||
$stickyTable = wo.$sticky = $table.clone()
|
$stickyTable = wo.$sticky = $table.clone()
|
||||||
.addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders)
|
.addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders + ' ' + c.namespace.slice(1) + '_extra_table' )
|
||||||
.wrap('<div class="' + ts.css.stickyWrap + '">'),
|
.wrap('<div class="' + ts.css.stickyWrap + '">'),
|
||||||
$stickyWrap = $stickyTable.parent()
|
$stickyWrap = $stickyTable.parent()
|
||||||
.addClass(ts.css.stickyHide)
|
.addClass(ts.css.stickyHide)
|
||||||
@ -1833,13 +1836,6 @@ ts.addWidget({
|
|||||||
if ($attach.length && !$attach.css('position')) {
|
if ($attach.length && !$attach.css('position')) {
|
||||||
$attach.css('position', 'relative');
|
$attach.css('position', 'relative');
|
||||||
}
|
}
|
||||||
// save stickyTable element to config
|
|
||||||
// it is also saved to wo.$sticky
|
|
||||||
if (c.$extraTables && c.$extraTables.length) {
|
|
||||||
c.$extraTables.add($stickyTable);
|
|
||||||
} else {
|
|
||||||
c.$extraTables = $stickyTable;
|
|
||||||
}
|
|
||||||
// fix clone ID, if it exists - fixes #271
|
// fix clone ID, if it exists - fixes #271
|
||||||
if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
|
if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
|
||||||
// clear out cloned table, except for sticky header
|
// clear out cloned table, except for sticky header
|
||||||
|
@ -95,7 +95,7 @@ ts.addWidget({
|
|||||||
nestedStickyTop = $nestedSticky.length ? $nestedSticky.height() : 0,
|
nestedStickyTop = $nestedSticky.length ? $nestedSticky.height() : 0,
|
||||||
// clone table, then wrap to make sticky header
|
// clone table, then wrap to make sticky header
|
||||||
$stickyTable = wo.$sticky = $table.clone()
|
$stickyTable = wo.$sticky = $table.clone()
|
||||||
.addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders)
|
.addClass('containsStickyHeaders ' + ts.css.sticky + ' ' + wo.stickyHeaders + ' ' + c.namespace.slice(1) + '_extra_table' )
|
||||||
.wrap('<div class="' + ts.css.stickyWrap + '">'),
|
.wrap('<div class="' + ts.css.stickyWrap + '">'),
|
||||||
$stickyWrap = $stickyTable.parent()
|
$stickyWrap = $stickyTable.parent()
|
||||||
.addClass(ts.css.stickyHide)
|
.addClass(ts.css.stickyHide)
|
||||||
@ -153,13 +153,6 @@ ts.addWidget({
|
|||||||
if ($attach.length && !$attach.css('position')) {
|
if ($attach.length && !$attach.css('position')) {
|
||||||
$attach.css('position', 'relative');
|
$attach.css('position', 'relative');
|
||||||
}
|
}
|
||||||
// save stickyTable element to config
|
|
||||||
// it is also saved to wo.$sticky
|
|
||||||
if (c.$extraTables && c.$extraTables.length) {
|
|
||||||
c.$extraTables.add($stickyTable);
|
|
||||||
} else {
|
|
||||||
c.$extraTables = $stickyTable;
|
|
||||||
}
|
|
||||||
// fix clone ID, if it exists - fixes #271
|
// fix clone ID, if it exists - fixes #271
|
||||||
if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
|
if ($stickyTable.attr('id')) { $stickyTable[0].id += wo.stickyHeaders_cloneId; }
|
||||||
// clear out cloned table, except for sticky header
|
// clear out cloned table, except for sticky header
|
||||||
|
@ -58,8 +58,8 @@ ts.addWidget({
|
|||||||
format: function(table, c, wo) {
|
format: function(table, c, wo) {
|
||||||
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
var i, hdr, icon, time, $header, $icon, $tfoot, $h, oldtheme, oldremove, oldIconRmv, hasOldTheme,
|
||||||
themesAll = ts.themes,
|
themesAll = ts.themes,
|
||||||
$table = c.$table.add( c.$extraTables ),
|
$table = c.$table.add( $( c.namespace + '_extra_table' ) ),
|
||||||
$headers = c.$headers.add( c.$extraHeaders ),
|
$headers = c.$headers.add( $( c.namespace + '_extra_headers' ) ),
|
||||||
theme = c.theme || 'jui',
|
theme = c.theme || 'jui',
|
||||||
themes = themesAll[theme] || {},
|
themes = themesAll[theme] || {},
|
||||||
remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
|
remove = $.trim( [ themes.sortNone, themes.sortDesc, themes.sortAsc, themes.active ].join( ' ' ) ),
|
||||||
@ -130,7 +130,10 @@ ts.addWidget({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < c.columns; i++) {
|
for (i = 0; i < c.columns; i++) {
|
||||||
$header = c.$headers.add(c.$extraHeaders).not('.sorter-false').filter('[data-column="' + i + '"]');
|
$header = c.$headers
|
||||||
|
.add($(c.namespace + '_extra_headers'))
|
||||||
|
.not('.sorter-false')
|
||||||
|
.filter('[data-column="' + i + '"]');
|
||||||
$icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
|
$icon = (ts.css.icon) ? $header.find('.' + ts.css.icon) : $();
|
||||||
$h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
|
$h = $headers.not('.sorter-false').filter('[data-column="' + i + '"]:last');
|
||||||
if ($h.length) {
|
if ($h.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user