Skip to content

Commit

Permalink
Docs: add notes on sortList overriding sortForce & sortAppend. See #1286
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Nov 8, 2016
1 parent 25e55e9 commit f8a205c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1260,8 +1260,10 @@ <h1>Configuration</h1>
<td>null</td>
<td>Use to add an additional forced sort that is <strong>prepended</strong> to <a href="#sortlist"><code>sortList</code></a>.
<div class="collapsible">
<br>
For example, <code>sortForce: [[0,0]]</code> will sort the first column in ascending order. After the forced sort, the user selected column(s), or during initialzation, the sorting order defined in the sortList will follow. And lastly, the sort defined in the <a href="#sortappend"><code>sortAppend</code></a> option will be applied. More explicitly:<br>
<p>
<span class="label label-warning">NOTE</span> Only when the user interacts with the table will the <code>sortForce</code> and <code>sortAppend</code> settings be applied. During initialization, and while setting the <code>sortList</code> through the API, both the <code>sortForce</code> and <code>sortAppend</code> settings are ignored. This will allow you to have explicit control over the sorting.
</p>
For example, <code>sortForce: [[0,0]]</code> will sort the first column in ascending order. After the forced sort, the user selected column(s), <em>but not during initialzation</em>, the sorting order defined in the sortList will follow. And lastly, the sort defined in the <a href="#sortappend"><code>sortAppend</code></a> option will be applied. More explicitly:<br>
<br>
There are three options to determine the sort order and this is the order of priority:
<ol>
Expand All @@ -1287,7 +1289,9 @@ <h1>Configuration</h1>
<td>null</td>
<td>Use to add an initial sort to the table.
<div class="collapsible">
<br>
<p>
<span class="label label-warning">NOTE</span> Only when the user interacts with the table will the <code>sortForce</code> and <code>sortAppend</code> settings be applied. During initialization, and while setting the <code>sortList</code> through the API, both the <code>sortForce</code> and <code>sortAppend</code> settings are ignored. This will allow you to have explicit control over the sorting.
</p>
The value contains an array of instructions for per-column sorting and direction in the format: <code>[[columnIndex, sortDirection], ... ]</code> where columnIndex is a zero-based index for your columns left-to-right and sortDirection is 0 for Ascending and 1 for Descending. A valid argument that sorts ascending first by column 1 and then column 2 looks like: <code>[[0,0],[1,0]]</code>. Please see <a href="#sortforce"><code>sortForce</code></a> for more details on other sort order options.<br>
<pre class="prettyprint lang-js">$(function(){
$("table").tablesorter({
Expand Down Expand Up @@ -1315,7 +1319,9 @@ <h1>Configuration</h1>
<td>null</td>
<td>Use to add an additional forced sort that will be appended to the dynamic selections by the user (<span class="version updated">v2.24.0</span>).
<div class="collapsible">
<br>
<p>
<span class="label label-warning">NOTE</span> Only when the user interacts with the table will the <code>sortForce</code> and <code>sortAppend</code> settings be applied. During initialization, and while setting the <code>sortList</code> through the API, both the <code>sortForce</code> and <code>sortAppend</code> settings are ignored. This will allow you to have explicit control over the sorting.
</p>
For example, can be used to sort people alphabetically after some other user-selected sort that results in rows with the same value like dates or money due. It can help prevent data from appearing as though it has a random secondary sort.<br>
<pre class="prettyprint lang-js">$(function(){
$("table").tablesorter({
Expand Down

0 comments on commit f8a205c

Please sign in to comment.