mirror of
https://github.com/DataTables/DataTables.git
synced 2025-01-18 11:52:11 +01:00
New: Initialisation option - sortMulti. Allow / disallow multi-coloumn sorting
- Multi-coloumn sorting might not be a feature that everyone wants, so the ability to disable it is added in this commit. - This fixes issue #13.
This commit is contained in:
parent
20949ae51a
commit
b7915d7cf6
@ -103,6 +103,7 @@ _fnMap( oSettings.oFeatures, oInit, "bPaginate" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bLengthChange" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bFilter" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bSort" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bSortMulti" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bInfo" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bProcessing" );
|
||||
_fnMap( oSettings.oFeatures, oInit, "bAutoWidth" );
|
||||
|
@ -237,7 +237,7 @@ function _fnSortAttachListener ( settings, attachTo, colIdx, callback )
|
||||
var nextSort;
|
||||
|
||||
// If the shift key is pressed then we are multiple column sorting
|
||||
if ( e.shiftKey ) {
|
||||
if ( e.shiftKey && settings.oFeatures.bSortMulti ) {
|
||||
// Are we already doing some kind of sort on this column?
|
||||
var curr = _pluck( sorting, '0' );
|
||||
var idx = $.inArray( colIdx, curr );
|
||||
|
@ -743,6 +743,26 @@ DataTable.defaults = {
|
||||
"bSort": true,
|
||||
|
||||
|
||||
/**
|
||||
* Enable or display DataTables' ability to sort multiple columns at the
|
||||
* same time (activated by shift-click by the user).
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @dtopt Options
|
||||
* @name DataTable.defaults.sortMulti
|
||||
*
|
||||
* @example
|
||||
* // Disable multiple column sorting ability
|
||||
* $(document).ready( function () {
|
||||
* $('#example').dataTable( {
|
||||
* "sortMulti": false
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"bSortMulti": true,
|
||||
|
||||
|
||||
/**
|
||||
* Allows control over whether DataTables should use the top (true) unique
|
||||
* cell that is found for a single column, or the bottom (false - default).
|
||||
|
@ -113,6 +113,14 @@ DataTable.models.oSettings = {
|
||||
*/
|
||||
"bSort": null,
|
||||
|
||||
/**
|
||||
* Multi-column sorting
|
||||
* Note that this parameter will be set by the initialisation routine. To
|
||||
* set a default use {@link DataTable.defaults}.
|
||||
* @type boolean
|
||||
*/
|
||||
"bSortMulti": null,
|
||||
|
||||
/**
|
||||
* Apply a class to the columns which are being sorted to provide a
|
||||
* visual highlight or not. This can slow things down when enabled since
|
||||
|
Loading…
x
Reference in New Issue
Block a user