Merged in sortResetKey enhancement

This commit is contained in:
Mottie 2012-12-18 16:39:37 -06:00
commit 7a28b694d8
2 changed files with 11 additions and 3 deletions

View File

@ -976,6 +976,14 @@
</td> </td>
<td><a href="example-option-sortreset-sortrestart.html">Example</a></td> <td><a href="example-option-sortreset-sortrestart.html">Example</a></td>
</tr> </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"> <tr id="sortrestart">
<td><span class="permalink">sortRestart</span></td> <td><span class="permalink">sortRestart</span></td>

View File

@ -39,9 +39,10 @@
cancelSelection : true, // prevent text selection in the header cancelSelection : true, // prevent text selection in the header
dateFormat : 'mmddyyyy', // other options: "ddmmyyy" or "yyyymmdd" dateFormat : 'mmddyyyy', // other options: "ddmmyyy" or "yyyymmdd"
sortMultiSortKey : 'shiftKey', // key used to select additional columns sortMultiSortKey : 'shiftKey', // key used to select additional columns
sortResetKey : 'ctrlKey', // key used to remove sorting on a column
usNumberFormat : true, // false for German "1.234.567,89" or French "1 234 567,89" 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 delayInit : false, // if false, the parsed table contents will not update until the first sort
serverSideSorting : false, // if true, server-side sorting should be performed because client-side sorting will be disabled, but the ui and events will still be used. serverSideSorting: false, // if true, server-side sorting should be performed because client-side sorting will be disabled, but the ui and events will still be used.
// sort options // sort options
headers : {}, // set sorter, string, empty, locked order, sortInitialOrder, filter, etc. headers : {}, // set sorter, string, empty, locked order, sortInitialOrder, filter, etc.
@ -456,7 +457,6 @@
} }
// sort multiple columns // sort multiple columns
/* */
function multisort(table) { /*jshint loopfunc:true */ function multisort(table) { /*jshint loopfunc:true */
var dynamicExp, sortWrapper, col, mx = 0, dir = 0, tc = table.config, var dynamicExp, sortWrapper, col, mx = 0, dir = 0, tc = table.config,
sortList = tc.sortList, l = sortList.length, bl = table.tBodies.length, sortList = tc.sortList, l = sortList.length, bl = table.tBodies.length,
@ -573,7 +573,7 @@
// $cell = $(this); // $cell = $(this);
k = !e[c.sortMultiSortKey]; k = !e[c.sortMultiSortKey];
// get current column sort order // 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 // reset all sorts on non-current column - issue #30
if (c.sortRestart) { if (c.sortRestart) {
i = cell; i = cell;