MCPcopy Create free account
hub / github.com/breck7/scroll / _fnSortResolve

Function _fnSortResolve

external/.datatables.js:5244–5277  ·  view source on GitHub ↗
(settings, nestedSort, sort)

Source from the content-addressed store, hash-verified

5242 }
5243
5244 function _fnSortResolve(settings, nestedSort, sort) {
5245 var push = function (a) {
5246 if ($.isPlainObject(a)) {
5247 if (a.idx !== undefined) {
5248 // Index based ordering
5249 nestedSort.push([a.idx, a.dir])
5250 } else if (a.name) {
5251 // Name based ordering
5252 var cols = _pluck(settings.aoColumns, "sName")
5253 var idx = cols.indexOf(a.name)
5254
5255 if (idx !== -1) {
5256 nestedSort.push([idx, a.dir])
5257 }
5258 }
5259 } else {
5260 // Plain column index and direction pair
5261 nestedSort.push(a)
5262 }
5263 }
5264
5265 if ($.isPlainObject(sort)) {
5266 // Object
5267 push(sort)
5268 } else if (sort.length && typeof sort[0] === "number") {
5269 // 1D array
5270 push(sort)
5271 } else if (sort.length) {
5272 // 2D array
5273 for (var z = 0; z < sort.length; z++) {
5274 push(sort[z]) // Object or array
5275 }
5276 }
5277 }
5278
5279 function _fnSortFlatten(settings) {
5280 var i,

Callers 2

_fnSortInitFunction · 0.85
_fnSortFlattenFunction · 0.85

Calls 1

pushFunction · 0.85

Tested by

no test coverage detected