MCPcopy Create free account
hub / github.com/blockstrap/framework / _fnSortData

Function _fnSortData

blockstrap/js/dependencies/tables.js:4654–4688  ·  view source on GitHub ↗
( settings, idx )

Source from the content-addressed store, hash-verified

4652 // Get the data to sort a column, be it from cache, fresh (populating the
4653 // cache), or from a sort formatter
4654 function _fnSortData( settings, idx )
4655 {
4656 // Custom sorting function - provided by the sort data type
4657 var column = settings.aoColumns[ idx ];
4658 var customSort = DataTable.ext.order[ column.sSortDataType ];
4659 var customData;
4660
4661 if ( customSort ) {
4662 customData = customSort.call( settings.oInstance, settings, idx,
4663 _fnColumnIndexToVisible( settings, idx )
4664 );
4665 }
4666
4667 // Use / populate cache
4668 var row, cellData;
4669 var formatter = DataTable.ext.type.order[ column.sType+"-pre" ];
4670
4671 for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) {
4672 row = settings.aoData[i];
4673
4674 if ( ! row._aSortData ) {
4675 row._aSortData = [];
4676 }
4677
4678 if ( ! row._aSortData[idx] || customSort ) {
4679 cellData = customSort ?
4680 customData[i] : // If there was a custom sort function, use data from there
4681 _fnGetCellData( settings, i, idx, 'sort' );
4682
4683 row._aSortData[ idx ] = formatter ?
4684 formatter( cellData ) :
4685 cellData;
4686 }
4687 }
4688 }
4689
4690
4691

Callers 1

_fnSortFunction · 0.85

Calls 2

_fnColumnIndexToVisibleFunction · 0.85
_fnGetCellDataFunction · 0.85

Tested by

no test coverage detected