mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Math: add math_event option
This commit is contained in:
parent
9993d77f38
commit
1de9c46e30
@ -176,6 +176,7 @@
|
|||||||
<h3><a href="#">Notes</a></h3>
|
<h3><a href="#">Notes</a></h3>
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>In <span class="version">v2.19.1</span>, added <code>math_event</code> option & fixed an issue with event unbinding in jQuery version < 1.9.</li>
|
||||||
<li>In <span class="version">v2.17.1</span>,
|
<li>In <span class="version">v2.17.1</span>,
|
||||||
<ul>
|
<ul>
|
||||||
<li>Values added to the data-attribute set by the <a href="../#textattribute"><code>textAttribute</code> option</a> will now be used in the calculation instead of the actual cell content.</li>
|
<li>Values added to the data-attribute set by the <a href="../#textattribute"><code>textAttribute</code> option</a> will now be used in the calculation instead of the actual cell content.</li>
|
||||||
@ -223,6 +224,14 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="math_event">
|
||||||
|
<td><span class="permalink">math_event</span></td>
|
||||||
|
<td><code>'recalculate'</code></td>
|
||||||
|
<td>
|
||||||
|
Set this option change the name of the event that the widget listens for to perform an update.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr id="math_ignore">
|
<tr id="math_ignore">
|
||||||
<td><a href="#" class="permalink">math_ignore</a></td>
|
<td><a href="#" class="permalink">math_ignore</a></td>
|
||||||
<td><code>[ ]</code></td>
|
<td><code>[ ]</code></td>
|
||||||
|
@ -494,7 +494,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="example-widget-header-titles.html">Header titles widget</a> (v2.15.6; <span class="version updated">2.15.7</span>)</li>
|
<li><a href="example-widget-header-titles.html">Header titles widget</a> (v2.15.6; <span class="version updated">2.15.7</span>)</li>
|
||||||
<li><a href="example-widget-math.html">Math widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.19.0</span>).</li>
|
<li><a href="example-widget-math.html">Math widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.19.1</span>).</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="example-widget-output.html">Output widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.19.0</span>)
|
<a href="example-widget-output.html">Output widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.19.0</span>)
|
||||||
<br><br>
|
<br><br>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
math = {
|
math = {
|
||||||
|
|
||||||
events : ( 'tablesorter-initialized update updateAll updateRows addRows updateCell ' +
|
events : ( 'tablesorter-initialized update updateAll updateRows addRows updateCell ' +
|
||||||
'filterReset filterEnd recalculate ' ).split(' ').join('.tsmath '),
|
'filterReset filterEnd ' ).split(' ').join('.tsmath '),
|
||||||
|
|
||||||
// get all of the row numerical values in an arry
|
// get all of the row numerical values in an arry
|
||||||
getRow : function(table, wo, $el, dataAttrib) {
|
getRow : function(table, wo, $el, dataAttrib) {
|
||||||
@ -388,12 +388,13 @@
|
|||||||
// template for or just prepend the mask prefix & suffix with this HTML
|
// template for or just prepend the mask prefix & suffix with this HTML
|
||||||
// e.g. '<span class="red">{content}</span>'
|
// e.g. '<span class="red">{content}</span>'
|
||||||
math_prefix : '',
|
math_prefix : '',
|
||||||
math_suffix : ''
|
math_suffix : '',
|
||||||
|
math_event : 'recalculate'
|
||||||
},
|
},
|
||||||
init : function(table, thisWidget, c, wo){
|
init : function(table, thisWidget, c, wo){
|
||||||
c.$table
|
c.$table
|
||||||
.off( $.trim(math.events) + ' updateComplete.tsmath' )
|
.off( $.trim(math.events) + ' ' + $.trim('updateComplete.tsmath ' + wo.math_event) )
|
||||||
.on( $.trim(math.events), function(e){
|
.on( $.trim(math.events) + ' ' + wo.math_event, function(e){
|
||||||
var init = e.type === 'tablesorter-initialized';
|
var init = e.type === 'tablesorter-initialized';
|
||||||
if (e.type === 'updateAll') {
|
if (e.type === 'updateAll') {
|
||||||
// redo data-column indexes in case columns were rearranged
|
// redo data-column indexes in case columns were rearranged
|
||||||
@ -414,7 +415,7 @@
|
|||||||
remove: function(table, c, wo, refreshing){
|
remove: function(table, c, wo, refreshing){
|
||||||
if (refreshing) { return; }
|
if (refreshing) { return; }
|
||||||
$(table)
|
$(table)
|
||||||
.off( $trim(math.events) + ' updateComplete.tsmath' )
|
.off( $trim(math.events) + ' ' + $.trim('updateComplete.tsmath ' + wo.math_event) )
|
||||||
.find('[data-' + wo.math_data + ']').empty();
|
.find('[data-' + wo.math_data + ']').empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user