mirror of
https://github.com/DataTables/DataTables.git
synced 2025-02-19 17:54:14 +01:00
New: Add postfix fixed ordering option
- With the change to camelCase, it is easier to extend the usageof optiosn now, and in this case I've allowed the `orderFixed` (formally `aaSortingFixed` parameter to be passed in as an object as well as an array. As an object the `pre` and `post` parameters are used to specify prefix and / or postfix ordering. Useful for gouping.
This commit is contained in:
parent
dd1e7600ac
commit
c85bcab903
@ -1 +1 @@
|
||||
a2dd5b40d76ce4522b126827c725fdf5fd3d608a
|
||||
953038e785e37682aa9fdb4e24402968615d5b4c
|
||||
|
31
media/js/jquery.dataTables.js
vendored
31
media/js/jquery.dataTables.js
vendored
@ -4098,7 +4098,35 @@
|
||||
aiOrig = [],
|
||||
aoColumns = settings.aoColumns,
|
||||
aDataSort, iCol, sType,
|
||||
nestedSort = settings.aaSortingFixed.concat( settings.aaSorting );
|
||||
fixed = settings.aaSortingFixed,
|
||||
fixedObj = $.isPlainObject( fixed ),
|
||||
nestedSort = [],
|
||||
add = function ( a ) {
|
||||
if ( a.length && ! $.isArray( a[0] ) ) {
|
||||
// 1D array
|
||||
nestedSort.push( a );
|
||||
}
|
||||
else {
|
||||
// 2D array
|
||||
nestedSort.push.apply( nestedSort, a );
|
||||
}
|
||||
};
|
||||
|
||||
// Build the sort array, with pre-fix and post-fix options if they have been
|
||||
// specified
|
||||
if ( $.isArray( fixed ) ) {
|
||||
add( fixed );
|
||||
}
|
||||
|
||||
if ( fixedObj && fixed.pre ) {
|
||||
add( fixed.pre );
|
||||
}
|
||||
|
||||
add( settings.aaSorting );
|
||||
|
||||
if (fixedObj && fixed.post ) {
|
||||
add( fixed.post );
|
||||
}
|
||||
|
||||
for ( i=0 ; i<nestedSort.length ; i++ )
|
||||
{
|
||||
@ -4139,7 +4167,6 @@
|
||||
aoColumns = oSettings.aoColumns,
|
||||
aDataSort, data, iCol, sType, oSort,
|
||||
formatters = 0,
|
||||
nestedSort = oSettings.aaSortingFixed.concat( oSettings.aaSorting ),
|
||||
sortCol,
|
||||
displayMaster = oSettings.aiDisplayMaster,
|
||||
aSort = _fnSortFlatten( oSettings );
|
||||
|
Loading…
x
Reference in New Issue
Block a user