mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
StaticRow: add staticRow_event option
This commit is contained in:
parent
1de9c46e30
commit
624af67ab0
@ -88,6 +88,10 @@
|
||||
<h3 id="notes"><a href="#">Notes</a></h3>
|
||||
<div>
|
||||
<ul>
|
||||
<li>
|
||||
In <span class="version">v2.19.1</span>, the <code>staticRow_event</code> option was added.
|
||||
<p></p>
|
||||
</li>
|
||||
<li>This widget will only work in tablesorter version 2.8+.</li>
|
||||
<li>The widget was modified from <a href="https://github.com/ascii-soup/Tablesorter-Static-Row-Plugin">Tablesorter-Static-Row-Plugin</a> by <a href="https://github.com/ascii-soup">ascii-soup</a> (<a href="https://github.com/ascii-soup/Tablesorter-Static-Row-Plugin/blob/master/LICENSE">MIT license</a>).</li>
|
||||
<li>It has been updated to work in tables with multiple tbodies, but not within information-only tbodies.</li>
|
||||
@ -114,6 +118,7 @@
|
||||
Set a class name to use to lock a row in place, include a period.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="staticrow_data">
|
||||
<td><span class="permalink">staticRow_data</span></td>
|
||||
<td><code>"static-index"</code></td>
|
||||
@ -122,6 +127,14 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="staticrow_event">
|
||||
<td><span class="permalink">staticRow_event</span></td>
|
||||
<td><code>"staticRowsRefresh"</code></td>
|
||||
<td>
|
||||
Set the event that the widget listens for to perform a refresh.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="staticrow_index">
|
||||
<td><a href="#" class="permalink">staticRow_index</a></td>
|
||||
<td><code>"row-index"</code></td>
|
||||
|
@ -512,7 +512,7 @@
|
||||
<li><span class="results">†</span> <a href="example-widget-resizable.html">Resizable Columns widget</a> (v2.0.23.1; <span class="version updated">v2.19.0</span>)</li>
|
||||
<li><span class="results">†</span> <a href="example-widget-savesort.html">Save sort widget</a> (v2.0.27)</li>
|
||||
<li><a href="example-widget-scroller.html">Scroller widget</a> (<span class="version">v2.9</span>; <span class="version updated">v2.19.0</span>).</li>
|
||||
<li><a href="example-widget-static-row.html">StaticRow widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.17.3</span>).</li>
|
||||
<li><a href="example-widget-static-row.html">StaticRow widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.19.1</span>).</li>
|
||||
<li><span class="results">†</span> <a href="example-widget-sticky-header.html">Sticky header widget</a> (v2.0.21.1; <span class="version updated">v2.18.0</span>)</li>
|
||||
<li><a href="example-widget-css-sticky-header.html">Sticky header (css3) widget</a> (<span class="version">v2.14.2</span>; <span class="version updated">v2.19.0</span>).</li>
|
||||
<li><span class="results">†</span> UITheme widget (<span class="version updated">v2.17.4</span>; <span class="version updated">v2.19.0</span>):
|
||||
|
@ -1,6 +1,5 @@
|
||||
/*
|
||||
* StaticRow widget for jQuery TableSorter 2.0
|
||||
* Version 1.2 - modified by Rob Garrison (6/28/2014 for tablesorter v2.16.1-beta+)
|
||||
/* StaticRow widget for jQuery TableSorter 2.0 - updated 2/9/2015 (v2.19.1)
|
||||
* Version 1.2 mod by Rob Garrison (requires tablesorter v2.16+)
|
||||
* Requires:
|
||||
* jQuery v1.4+
|
||||
* tablesorter plugin, v2.8+, available at http://mottie.github.com/tablesorter/docs/
|
||||
@ -16,9 +15,6 @@
|
||||
"use strict";
|
||||
var ts = $.tablesorter,
|
||||
|
||||
// events triggered on the table that update this widget
|
||||
events = $.trim( 'staticRowsRefresh updateComplete '.split(' ').join('.tsstaticrows ') ),
|
||||
|
||||
// add/refresh row indexes
|
||||
addIndexes = function(table){
|
||||
var $tr, wo, v, indx, rows,
|
||||
@ -55,15 +51,16 @@ ts.addWidget({
|
||||
options: {
|
||||
staticRow_class : '.static',
|
||||
staticRow_data : 'static-index',
|
||||
staticRow_index : 'row-index'
|
||||
staticRow_index : 'row-index',
|
||||
staticRow_event : 'staticRowsRefresh'
|
||||
},
|
||||
|
||||
init: function(table, thisWidget, c, wo){
|
||||
addIndexes(table);
|
||||
// refresh static rows after updates
|
||||
c.$table
|
||||
.unbind(events)
|
||||
.bind(events, function(){
|
||||
.unbind( $.trim('updateComplete.tsstaticrows ' + wo.staticRow_event) )
|
||||
.bind( $.trim('updateComplete.tsstaticrows ' + wo.staticRow_event), function(){
|
||||
addIndexes(table);
|
||||
c.$table.trigger('applyWidgets');
|
||||
});
|
||||
@ -116,7 +113,7 @@ ts.addWidget({
|
||||
},
|
||||
|
||||
remove : function(table, c, wo){
|
||||
c.$table.unbind(events);
|
||||
c.$table.unbind( $.trim('updateComplete.tsstaticrows ' + wo.staticRow_event) );
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user