mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Math widget: add data-math-mask for each cell & update doc versions
This commit is contained in:
parent
cb2435e423
commit
f57f73f5ea
@ -188,6 +188,10 @@ math_ignore : [0,1]</pre>
|
||||
<td>
|
||||
Set this option with an output formatting mask to use <sup class="remark">*</sup>
|
||||
<div class="collapsible">
|
||||
As of <span class="version">v2.16.2</span>, you can set a mask for each math cell by adding a <code>data-math-mask</code> data-attribute (the <code>math</code> part of the data-attribute is obtained from the <code>math_data</code> setting).
|
||||
<pre class="prettyprint lang-html"><th data-math="all-sum" data-math-mask="##0.00">all-sum</th></pre>
|
||||
<hr>
|
||||
<h3>Javascript-number-formatter details</h3>
|
||||
<h3>Features</h3>
|
||||
<ul>
|
||||
<li>Short, fast, flexible yet standalone. Only 75 lines including MIT license info, blank lines & comments.</li>
|
||||
@ -365,7 +369,7 @@ $.tablesorter.equations['product'] = function(arry) {
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="5">Grand Total</th>
|
||||
<th data-math="all-sum">all-sum</th>
|
||||
<th data-math="all-sum" data-math-mask="##0.00">all-sum</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
|
@ -462,13 +462,13 @@
|
||||
<li><span class="results">†</span> <a href="example-widget-columns.html">Columns Highlight widget</a> (v2.0.17)</li>
|
||||
<li><span class="label label-info">Beta</span> <a href="example-widget-column-selector.html">Column Selector widget</a> (<span class="version">v2.15</span>; <span class="version updated">v2.15.7</span>).</li>
|
||||
<li><a href="example-widget-editable.html">Content Editable widget</a> (v2.9; <span class="version updated">v2.13.2</span>).</li>
|
||||
<li><span class="results">†</span> Filter Widget:
|
||||
<li><span class="results">†</span> Filter Widget (<span class="version updated">v2.16</span>):
|
||||
<ul>
|
||||
<li><a href="example-widget-filter.html">basic</a> (v2.0.18; <span class="version updated">v2.15</span>)</li>
|
||||
<li><a href="example-widget-filter-any-match.html">external option (match any column)</a> (<span class="version">v2.13.3</span>; <span class="version updated">v2.15</span>)</li>
|
||||
<li><a href="example-widget-filter-external-inputs.html">external inputs</a> (<span class="version">v2.14</span>; <span class="version updated">v2.15</span>)</li>
|
||||
<li><a href="example-widget-filter-custom.html">custom</a> (v2.3.6; <span class="version updated">v2.10.1</span>)</li>
|
||||
<li>formatter: <a href="example-widget-filter-formatter-1.html">jQuery UI widgets</a> and <a href="example-widget-filter-formatter-2.html">HTML5 Elements</a> (v2.7.7; <span class="version updated">v2.15</span>).</li>
|
||||
<li>formatter: <a href="example-widget-filter-formatter-1.html">jQuery UI widgets</a> and <a href="example-widget-filter-formatter-2.html">HTML5 Elements</a> (v2.7.7; <span class="version updated">v2.16</span>).</li>
|
||||
<li>formatter: <a href="example-widget-filter-formatter-select2.html">select2</a> (<span class="version updated">v2.16.0</span>)</li>
|
||||
</ul>
|
||||
</li>
|
||||
@ -479,15 +479,15 @@
|
||||
</ul>
|
||||
</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><span class="label label-info">Beta</span> <a href="example-widget-math.html">Math widget</a> (<span class="version">v2.16</span>).</li>
|
||||
<li><span class="label label-info">Beta</span> <a href="example-widget-math.html">Math widget</a> (<span class="version">v2.16</span>; <span class="version updated">v2.16.2</span>).</li>
|
||||
<li>
|
||||
<span class="label label-info">Beta</span> <a href="example-widget-output.html">Output widget</a> (<span class="version">v2.16</span>)
|
||||
<br><br>
|
||||
</li>
|
||||
|
||||
<li><a href="example-pager.html">Pager plugin</a> (<span class="version updated">v2.15</span>).</li>
|
||||
<li><a href="example-pager.html">Pager plugin</a> (<span class="version updated">v2.16</span>).</li>
|
||||
<li>
|
||||
<span class="label label-info">Beta</span> Pager widget (<a href="example-widget-pager.html">basic</a> & <a href="example-widget-pager-ajax.html">ajax</a> demos) (<span class="version">v2.12</span>; <span class="version updated">v2.15</span>).<br>
|
||||
<span class="label label-info">Beta</span> Pager widget (<a href="example-widget-pager.html">basic</a> & <a href="example-widget-pager-ajax.html">ajax</a> demos) (<span class="version">v2.12</span>; <span class="version updated">v2.16</span>).<br>
|
||||
<br>
|
||||
</li>
|
||||
|
||||
@ -495,10 +495,10 @@
|
||||
<li><a href="example-widgets.html">Repeat Headers widget</a> (v2.0.5; <span class="version updated">v2.9</span>)</li>
|
||||
<li><span class="results">†</span> <a href="example-widget-resizable.html">Resizable Columns widget</a> (v2.0.23.1; <span class="version updated">v2.15.12</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>).</li>
|
||||
<li><a href="example-widget-scroller.html">Scroller widget</a> (<span class="version">v2.9</span>; <span class="version updated">v2.16</span>).</li>
|
||||
<li><span class="label label-info">Beta</span> <a href="example-widget-static-row.html">StaticRow widget</a> (<span class="version">v2.16</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.14.4</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.15</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.16</span>).</li>
|
||||
<li><span class="results">†</span> UITheme widget:
|
||||
<ul>
|
||||
<li><a href="example-widget-ui-theme.html">jQuery UI theme</a> (v2.0.9; <span class="version updated">v2.13.3</span>)</li>
|
||||
@ -3246,7 +3246,7 @@ This ajaxProcessing function must return an object with "total", "headers" and "
|
||||
<td><span class="permalink">pageReset</span></td>
|
||||
<td>Numeric, Boolean</td>
|
||||
<td>0</td>
|
||||
<td>Reset pager to this page after filtering; set to desired page number (zero-based index), or <code>false</code> to not change page at filter start.</td>
|
||||
<td>Reset pager to this page after filtering; set to desired page number (zero-based index), or <code>false</code> to not change page at filter start (<span class="version updated">v2.16</span>).</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
@ -3523,7 +3523,7 @@ This ajaxProcessing function must return an object with "total", "headers" and "
|
||||
|
||||
<tr id="addrows">
|
||||
<td><a href="#" class="permalink">addRows</a></td>
|
||||
<td>Use this method to add table rows (v2.0.16).
|
||||
<td>Use this method to add table rows (v2.0.16; <span class="version updated">v2.16.1</span>).
|
||||
<div class="collapsible">
|
||||
It does not work the same as "update" in that it only adds rows, it does not remove them.<br>
|
||||
Also, use this method to add table rows while using the pager plugin. If the "update" method is used, only the visible table rows continue to exist.
|
||||
@ -3745,8 +3745,9 @@ $("table")
|
||||
|
||||
<tr id="applywidgets">
|
||||
<td><a href="#" class="permalink">applyWidgets</a></td>
|
||||
<td>Apply the set widgets to the table. This method can be used after a table has been initialized, but it won't work unless you update the configuration settings. See the example, it's easier than describing it.
|
||||
<td>Apply the set widgets to the table (<span class="version updated">v2.16.0</span>).
|
||||
<div class="collapsible">
|
||||
This method can be used after a table has been initialized, but it won't work unless you update the configuration settings. See the example, it's easier than describing it.
|
||||
<pre class="prettyprint lang-js">// Update the list of widgets to apply to the table (add or remove)
|
||||
// $("table").data("tablesorter").widgets = ["zebra"]; // works the same as
|
||||
$("table")[0].config.widgets = ["zebra"];
|
||||
@ -3760,7 +3761,7 @@ $('table').trigger('applyWidgets');
|
||||
|
||||
<tr id="destroy">
|
||||
<td><a href="#" class="permalink">destroy</a></td>
|
||||
<td>Use this method to remove tablesorter from the table (v2.3.2).
|
||||
<td>Use this method to remove tablesorter from the table (v2.3.2; <span class="version updated">v2.16</span>).
|
||||
<div class="collapsible">
|
||||
<pre class="prettyprint lang-js">// Remove tablesorter and all classes
|
||||
$("table").trigger("destroy");
|
||||
@ -4981,7 +4982,7 @@ widget.format( table, table.config, table.config.widgetOptions );</pre>
|
||||
|
||||
<tr id="function-applywidget">
|
||||
<td><a href="#" class="permalink">applyWidget</a></td>
|
||||
<td>This function applys (refreshes) all currently selected widgets on a table.
|
||||
<td>This function applys (refreshes) all currently selected widgets on a table (<span class="version updated">v2.16.0</span>).
|
||||
<div class="collapsible"><br>
|
||||
Use it as follows:
|
||||
<pre class="prettyprint lang-js">$.tablesorter.applyWidget( table, init );</pre>
|
||||
@ -5185,7 +5186,7 @@ $.tablesorter.getFilters( $('table') );</pre>
|
||||
|
||||
<tr id="function-setfilters">
|
||||
<td><a href="#" class="permalink">setFilters</a></td>
|
||||
<td>This filter widget function allows setting of the filters; include a <code>true</code> boolean to actually apply the search (<span class="version">v2.9</span>; <span class="version updated">v2.15</span>):
|
||||
<td>This filter widget function allows setting of the filters; include a <code>true</code> boolean to actually apply the search (<span class="version">v2.9</span>; <span class="version updated">v2.16</span>):
|
||||
<div class="collapsible"><br>
|
||||
Access it as follows:
|
||||
<pre class="prettyprint lang-js">$.tablesorter.setFilters(table, filter, apply);</pre>
|
||||
|
@ -149,7 +149,8 @@
|
||||
},
|
||||
|
||||
output : function($cell, wo, value, arry) {
|
||||
var result = ts.formatMask( wo.math_mask, value );
|
||||
// get mask from cell data-attribute: data-math-mask="#,##0.00"
|
||||
var result = ts.formatMask( $cell.attr('data-' + wo.math_data + '-mask') || wo.math_mask, value );
|
||||
if ($.isFunction(wo.math_complete)) {
|
||||
result = wo.math_complete($cell, wo, result, value, arry);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user