Core: add "emptyMin" & "emptyMax" settings to emptyTo option. Fixes #577

This commit is contained in:
Mottie 2014-04-25 23:16:28 -05:00
parent 03ab6d638b
commit d257a015cc
2 changed files with 9 additions and 3 deletions

View File

@ -827,12 +827,14 @@
<td>String</td> <td>String</td>
<td>&quot;bottom&quot;</td> <td>&quot;bottom&quot;</td>
<td> <td>
Boolean flag indicating how tablesorter should deal with empty table cells. (Modified v2.1.16). Boolean flag indicating how tablesorter should deal with empty table cells. (Modified v2.1.16, <span class="version updated">v2.16.2</span>).
<div class="collapsible"> <div class="collapsible">
<ul> <ul>
<li><code>bottom</code> - sort empty table cells to the bottom.</li> <li><code>bottom</code> - sort empty table cells to the bottom.</li>
<li><code>top</code> - sort empty table cells to the top.</li> <li><code>top</code> - sort empty table cells to the top.</li>
<li><code>none</code> or <code>zero</code> - sort empty table cells as if the cell has the value equal to zero.</li> <li><code>none</code> or <code>zero</code> - sort empty table cells as if the cell has the value equal to zero.</li>
<li><code>emptyMax</code> - sort empty table cells as having a value greater than the <em>max</em> (more positive) value (added <span class="version">v2.16.2</span>).</li>
<li><code>emptyMin</code> - sort empty table cells as having a value greater than the <em>min</em> (more negative) value (added <span class="version">v2.16.2</span>).</li>
</ul> </ul>
Individual columns can be modified by adding the following (they all do the same thing), set in order of priority: Individual columns can be modified by adding the following (they all do the same thing), set in order of priority:
<ul> <ul>
@ -3525,7 +3527,9 @@ This ajaxProcessing function must return an object with "total", "headers" and "
<td><a href="#" class="permalink">addRows</a></td> <td><a href="#" class="permalink">addRows</a></td>
<td>Use this method to add table rows (v2.0.16; <span class="version updated">v2.16.1</span>). <td>Use this method to add table rows (v2.0.16; <span class="version updated">v2.16.1</span>).
<div class="collapsible"> <div class="collapsible">
<br>
It does not work the same as &quot;update&quot; in that it only adds rows, it does not remove them.<br> It does not work the same as &quot;update&quot; in that it only adds rows, it does not remove them.<br>
<br>
Also, use this method to add table rows while using the pager plugin. If the &quot;update&quot; method is used, only the visible table rows continue to exist. Also, use this method to add table rows while using the pager plugin. If the &quot;update&quot; method is used, only the visible table rows continue to exist.
<pre class="prettyprint lang-js">// Add multiple rows to the table <pre class="prettyprint lang-js">// Add multiple rows to the table
var row = '&lt;tr&gt;&lt;td&gt;Inigo&lt;/td&gt;&lt;td&gt;Montoya&lt;/td&gt;&lt;td&gt;34&lt;/td&gt;' + var row = '&lt;tr&gt;&lt;td&gt;Inigo&lt;/td&gt;&lt;td&gt;Montoya&lt;/td&gt;&lt;td&gt;34&lt;/td&gt;' +
@ -3540,7 +3544,9 @@ This ajaxProcessing function must return an object with "total", "headers" and "
}; };
$('table') $('table')
.find('tbody').append($row) .find('tbody').append($row)
.trigger('addRows', [$row, resort, callback]);</pre></div> .trigger('addRows', [$row, resort, callback]);</pre>
In <span class="version">v2.16.1</span>, the <code>$row</code> parameter can be an HTML string, row DOM element or jQuery object.
</div>
</td> </td>
<td><a href="example-add-rows.html">Example</a></td> <td><a href="example-add-rows.html">Example</a></td>
</tr> </tr>

View File

@ -963,7 +963,7 @@
return (version[0] > 1) || (version[0] === 1 && parseInt(version[1], 10) >= 4); return (version[0] > 1) || (version[0] === 1 && parseInt(version[1], 10) >= 4);
})($.fn.jquery.split(".")); })($.fn.jquery.split("."));
// digit sort text location; keeping max+/- for backwards compatibility // digit sort text location; keeping max+/- for backwards compatibility
c.string = { 'max': 1, 'min': -1, 'max+': 1, 'max-': -1, 'zero': 0, 'none': 0, 'null': 0, 'top': true, 'bottom': false }; c.string = { 'max': 1, 'min': -1, 'emptyMin': 1, 'emptyMax': -1, 'zero': 0, 'none': 0, 'null': 0, 'top': true, 'bottom': false };
// add table theme class only if there isn't already one there // add table theme class only if there isn't already one there
if (!/tablesorter\-/.test($table.attr('class'))) { if (!/tablesorter\-/.test($table.attr('class'))) {
k = (c.theme !== '' ? ' tablesorter-' + c.theme : ''); k = (c.theme !== '' ? ' tablesorter-' + c.theme : '');