Added a sortResetKey property to allow for removing the sort on a column through the use of a key modifier.

Updated documentation to show this property.
This commit is contained in:
emmerich 2012-12-17 11:44:02 +00:00
parent 351e3ad699
commit ce5bc8d364
2 changed files with 10 additions and 1 deletions

View File

@ -968,6 +968,14 @@
</td>
<td><a href="example-option-sortreset-sortrestart.html">Example</a></td>
</tr>
<tr id="sortResetKey">
<td>sortResetKey</td>
<td>String</td>
<td>"ctrlKey"</td>
<td>The key used to reset sorting on the entire table. Defaults to the control key. The other options are <code>"shiftKey"</code> or <code>"altKey"</code>. Reference: <a class="external" href="https://developer.mozilla.org/en/DOM/MouseEvent">https://developer.mozilla.org/en/DOM/MouseEvent</a></td>
<td></td>
</tr>
<tr id="sortrestart">
<td><span class="permalink">sortRestart</span></td>

View File

@ -40,6 +40,7 @@
sortMultiSortKey : 'shiftKey', // key used to select additional columns
usNumberFormat : true, // false for German "1.234.567,89" or French "1 234 567,89"
delayInit : false, // if false, the parsed table contents will not update until the first sort
sortResetKey : 'ctrlKey', // key used to remove sorting on a column
// sort options
headers : {}, // set sorter, string, empty, locked order, sortInitialOrder, filter, etc.
@ -568,7 +569,7 @@
// $cell = $(this);
k = !e[c.sortMultiSortKey];
// get current column sort order
cell.count = (cell.count + 1) % (c.sortReset ? 3 : 2);
cell.count = e[c.sortResetKey] ? 2 : (cell.count + 1) % (c.sortReset ? 3 : 2);
// reset all sorts on non-current column - issue #30
if (c.sortRestart) {
i = cell;