From c2c6e1b1149014dab34e788c546e3a4a3526c4af Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Thu, 3 May 2012 15:04:23 +0200 Subject: [PATCH] CC-3735 : Now Playing: Browser(Firefox) Mem usage goes high when play a show with hundreds of songs more than 3 hours updating datatables to stable 1.9.1 release. optimizing javascript, using jquery to add/remove nodes to avoid JQuery.cache issues. --- .../public/js/airtime/showbuilder/builder.js | 123 +++-- .../js/datatables/js/jquery.dataTables.js | 460 +++++++++++++----- 2 files changed, 399 insertions(+), 184 deletions(-) diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 4bd962691..c8795bd40 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -143,35 +143,34 @@ var AIRTIME = (function(AIRTIME){ mod.checkToolBarIcons(); }; + + mod.fnItemCallback = function(json) { + checkError(json); + oSchedTable.fnDraw(); + }; mod.fnAdd = function(aMediaIds, aSchedIds) { $.post("/showbuilder/schedule-add", {"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds}, - function(json){ - checkError(json); - oSchedTable.fnDraw(); - }); + mod.fnItemCallback + ); }; mod.fnMove = function(aSelect, aAfter) { $.post("/showbuilder/schedule-move", {"format": "json", "selectedItem": aSelect, "afterItem": aAfter}, - function(json){ - checkError(json); - oSchedTable.fnDraw(); - }); + mod.fnItemCallback + ); }; mod.fnRemove = function(aItems) { $.post( "/showbuilder/schedule-remove", {"items": aItems, "format": "json"}, - function(json) { - checkError(json); - oSchedTable.fnDraw(); - }); + mod.fnItemCallback + ); }; mod.fnRemoveSelectedItems = function() { @@ -189,10 +188,10 @@ var AIRTIME = (function(AIRTIME){ mod.fnRemove(aItems); }; - mod.fnServerData = function ( sSource, aoData, fnCallback ) { + mod.fnServerData = function fnBuilderServerData( sSource, aoData, fnCallback ) { - aoData.push( { name: "timestamp", value: AIRTIME.showbuilder.getTimestamp()} ); - aoData.push( { name: "instances", value: AIRTIME.showbuilder.getShowInstances()} ); + aoData.push( { name: "timestamp", value: mod.getTimestamp()} ); + aoData.push( { name: "instances", value: mod.getShowInstances()} ); aoData.push( { name: "format", value: "json"} ); if (mod.fnServerData.hasOwnProperty("start")) { @@ -212,8 +211,8 @@ var AIRTIME = (function(AIRTIME){ "url": sSource, "data": aoData, "success": function(json) { - AIRTIME.showbuilder.setTimestamp(json.timestamp); - AIRTIME.showbuilder.setShowInstances(json.instances); + mod.setTimestamp(json.timestamp); + mod.setShowInstances(json.instances); fnCallback(json); } }); @@ -295,12 +294,12 @@ var AIRTIME = (function(AIRTIME){ oData.iCreate = parseInt(oData.iCreate, 10); }, - "fnServerData": AIRTIME.showbuilder.fnServerData, + "fnServerData": mod.fnServerData, "fnRowCallback": function fnRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { - var i, + var i, length, sSeparatorHTML, fnPrepareSeparatorRow, - node, + $node, cl="", //background-color to imitate calendar color. r,g,b,a, @@ -310,37 +309,37 @@ var AIRTIME = (function(AIRTIME){ fnPrepareSeparatorRow = function fnPrepareSeparatorRow(sRowContent, sClass, iNodeIndex) { - node = nRow.children[iNodeIndex]; - node.innerHTML = sRowContent; - node.setAttribute('colspan',100); - for (i = iNodeIndex + 1; i < nRow.children.length; i = i+1) { - node = nRow.children[i]; - node.innerHTML = ""; - node.setAttribute("style", "display : none"); + $node = $(nRow.children[iNodeIndex]); + $node.html(sRowContent); + $node.attr('colspan',100); + for (i = iNodeIndex + 1, length = nRow.children.length; i < length; i = i+1) { + $node = $(nRow.children[i]); + $node.html(""); + $node.attr("style", "display : none"); } - $(nRow).addClass(sClass); + $nRow.addClass(sClass); }; if (aData.header === true) { //remove the column classes from all tds. - $(nRow).find('td').removeClass(); + $nRow.find('td').removeClass(); - node = nRow.children[0]; - node.innerHTML = ''; + $node = $(nRow.children[0]); + $node.html(""); cl = 'sb-header'; if (aData.record === true) { $div = $("
", { "class": "small-icon recording" }); - $(node).append($div); + $node.append($div); } - else if(aData.rebroadcast === true) { + else if (aData.rebroadcast === true) { $div = $("
", { "class": "small-icon rebroadcast" }); - $(node).append($div); + $node.append($div); } sSeparatorHTML = ''+aData.title+''; @@ -366,18 +365,18 @@ var AIRTIME = (function(AIRTIME){ } else if (aData.footer === true) { //remove the column classes from all tds. - $(nRow).find('td').removeClass(); + $nRow.find('td').removeClass(); - node = nRow.children[0]; + $node = $(nRow.children[0]); cl = 'sb-footer'; //check the show's content status. if (aData.runtime > 0) { - node.innerHTML = ''; + $node.html(''); cl = cl + ' ui-state-highlight'; } else { - node.innerHTML = ''; + $node.html(''); cl = cl + ' ui-state-error'; } @@ -386,10 +385,10 @@ var AIRTIME = (function(AIRTIME){ } else if (aData.empty === true) { //remove the column classes from all tds. - $(nRow).find('td').removeClass(); + $nRow.find('td').removeClass(); - node = nRow.children[0]; - node.innerHTML = ''; + $node = $(nRow.children[0]); + $node.html(''); sSeparatorHTML = 'Show Empty'; cl = cl + " sb-empty odd"; @@ -398,10 +397,10 @@ var AIRTIME = (function(AIRTIME){ } else if (aData.record === true) { //remove the column classes from all tds. - $(nRow).find('td').removeClass(); + $nRow.find('td').removeClass(); - node = nRow.children[0]; - node.innerHTML = ''; + $node = $(nRow.children[0]); + $node.html(''); sSeparatorHTML = 'Recording From Line In'; cl = cl + " sb-record odd"; @@ -411,7 +410,7 @@ var AIRTIME = (function(AIRTIME){ else { //add the play function if the file exists on disk. - $image = $(nRow).find('td.sb-image'); + $image = $nRow.find('td.sb-image'); //check if the file exists. if (aData.image === true) { $image.html('') @@ -424,12 +423,12 @@ var AIRTIME = (function(AIRTIME){ $image.html(''); } - node = nRow.children[0]; + $node = $(nRow.children[0]); if (aData.allowed === true && aData.scheduled >= 1) { - node.innerHTML = ''; + $node.html(''); } else { - node.innerHTML = ''; + $node.html(''); } } @@ -455,39 +454,39 @@ var AIRTIME = (function(AIRTIME){ } //save some info for reordering purposes. - $(nRow).data({"aData": aData}); + $nRow.data({"aData": aData}); if (aData.scheduled === 1) { - $(nRow).addClass("sb-now-playing"); + $nRow.addClass("sb-now-playing"); } else if (aData.scheduled === 0) { - $(nRow).addClass("sb-past"); + $nRow.addClass("sb-past"); } else { - $(nRow).addClass("sb-future"); + $nRow.addClass("sb-future"); } if (aData.allowed !== true) { - $(nRow).addClass("sb-not-allowed"); + $nRow.addClass("sb-not-allowed"); } else { - $(nRow).addClass("sb-allowed"); + $nRow.addClass("sb-allowed"); } //status used to colour tracks. if (aData.status === 2) { - $(nRow).addClass("sb-boundry"); + $nRow.addClass("sb-boundry"); } else if (aData.status === 0) { - $(nRow).addClass("sb-over"); + $nRow.addClass("sb-over"); } if (aData.currentShow === true) { - $(nRow).addClass("sb-current-show"); + $nRow.addClass("sb-current-show"); } //call the context menu so we can prevent the event from propagating. - $(nRow).find('td:gt(1)').click(function(e){ + $nRow.find('td:gt(1)').click(function(e){ $(this).contextMenu({x: e.pageX, y: e.pageY}); @@ -513,7 +512,7 @@ var AIRTIME = (function(AIRTIME){ //use this array to cache DOM heights then we can detach the table to manipulate it to increase speed. heights = []; - clearTimeout(AIRTIME.showbuilder.timeout); + clearTimeout(mod.timeout); //only create the cursor arrows if the library is on the page. if ($lib.length > 0 && $lib.filter(":visible").length > 0) { @@ -574,7 +573,7 @@ var AIRTIME = (function(AIRTIME){ if (temp.length > 0) { aData = temp.data("aData"); - setTimeout(mod.refresh, aData.refresh * 1000); //need refresh in milliseconds + mod.timeout = setTimeout(mod.refresh, aData.refresh * 1000); //need refresh in milliseconds break; } } @@ -646,7 +645,7 @@ var AIRTIME = (function(AIRTIME){ } aSchedIds.push({"id": oPrevData.id, "instance": oPrevData.instance, "timestamp": oPrevData.timestamp}); - AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds); + mod.fnAdd(aMediaIds, aSchedIds); }; fnMove = function() { @@ -659,7 +658,7 @@ var AIRTIME = (function(AIRTIME){ aAfter.push({"id": oPrevData.id, "instance": oPrevData.instance, "timestamp": oPrevData.timestamp}); - AIRTIME.showbuilder.fnMove(aSelect, aAfter); + mod.fnMove(aSelect, aAfter); }; fnReceive = function(event, ui) { diff --git a/airtime_mvc/public/js/datatables/js/jquery.dataTables.js b/airtime_mvc/public/js/datatables/js/jquery.dataTables.js index 1ef8973c9..ab61ea58e 100644 --- a/airtime_mvc/public/js/datatables/js/jquery.dataTables.js +++ b/airtime_mvc/public/js/datatables/js/jquery.dataTables.js @@ -1,7 +1,7 @@ /** * @summary DataTables * @description Paginate, search and sort HTML tables - * @version 1.9.1.dev + * @version 1.9.1 * @file jquery.dataTables.js * @author Allan Jardine (www.sprymedia.co.uk) * @contact www.sprymedia.co.uk/contact @@ -21,7 +21,7 @@ */ /*jslint evil: true, undef: true, browser: true */ -/*globals $, jQuery,_fnExternApiFunc,_fnInitialise,_fnInitComplete,_fnLanguageCompat,_fnAddColumn,_fnColumnOptions,_fnAddData,_fnCreateTr,_fnGatherData,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnServerParams,_fnAddOptionsHtml,_fnFeatureHtmlTable,_fnScrollDraw,_fnAdjustColumnSizing,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnBuildSearchArray,_fnBuildSearchRow,_fnFilterCreateSearch,_fnDataToSearch,_fnSort,_fnSortAttachListener,_fnSortingClasses,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnFeatureHtmlLength,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnNodeToDataIndex,_fnVisbleColumns,_fnCalculateEnd,_fnConvertToWidth,_fnCalculateColumnWidths,_fnScrollingWidthAdjust,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnDetectType,_fnSettingsFromNode,_fnGetDataMaster,_fnGetTrNodes,_fnGetTdNodes,_fnEscapeRegex,_fnDeleteIndex,_fnReOrderIndex,_fnColumnOrdering,_fnLog,_fnClearTable,_fnSaveState,_fnLoadState,_fnCreateCookie,_fnReadCookie,_fnDetectHeader,_fnGetUniqueThs,_fnScrollBarWidth,_fnApplyToChildren,_fnMap,_fnGetRowData,_fnGetCellData,_fnSetCellData,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnApplyColumnDefs,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnJsonString,_fnRender,_fnNodeToColumnIndex*/ +/*globals $, jQuery,_fnExternApiFunc,_fnInitialise,_fnInitComplete,_fnLanguageCompat,_fnAddColumn,_fnColumnOptions,_fnAddData,_fnCreateTr,_fnGatherData,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnServerParams,_fnAddOptionsHtml,_fnFeatureHtmlTable,_fnScrollDraw,_fnAdjustColumnSizing,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnBuildSearchArray,_fnBuildSearchRow,_fnFilterCreateSearch,_fnDataToSearch,_fnSort,_fnSortAttachListener,_fnSortingClasses,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnFeatureHtmlLength,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnNodeToDataIndex,_fnVisbleColumns,_fnCalculateEnd,_fnConvertToWidth,_fnCalculateColumnWidths,_fnScrollingWidthAdjust,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnDetectType,_fnSettingsFromNode,_fnGetDataMaster,_fnGetTrNodes,_fnGetTdNodes,_fnEscapeRegex,_fnDeleteIndex,_fnReOrderIndex,_fnColumnOrdering,_fnLog,_fnClearTable,_fnSaveState,_fnLoadState,_fnCreateCookie,_fnReadCookie,_fnDetectHeader,_fnGetUniqueThs,_fnScrollBarWidth,_fnApplyToChildren,_fnMap,_fnGetRowData,_fnGetCellData,_fnSetCellData,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnApplyColumnDefs,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnJsonString,_fnRender,_fnNodeToColumnIndex,_fnInfoMacros*/ (/** @lends */function($, window, document, undefined) { /** @@ -445,9 +445,8 @@ /* Create the object for storing information about this new row */ var iRow = oSettings.aoData.length; - var oData = $.extend( true, {}, DataTable.models.oRow, { - "_aData": aDataIn - } ); + var oData = $.extend( true, {}, DataTable.models.oRow ); + oData._aData = aDataIn; oSettings.aoData.push( oData ); /* Create the cells */ @@ -461,6 +460,10 @@ { _fnSetCellData( oSettings, iRow, i, _fnRender(oSettings, iRow, i) ); } + else + { + _fnSetCellData( oSettings, iRow, i, _fnGetCellData( oSettings, iRow, i ) ); + } /* See if we should auto-detect the column type */ if ( oCol._bAutoType && oCol.sType != 'string' ) @@ -738,8 +741,9 @@ { if ( oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null ) { - _fnLog( oSettings, 0, "Requested unknown parameter '"+oCol.mDataProp+ - "' from the data source for row "+iRow ); + _fnLog( oSettings, 0, "Requested unknown parameter "+ + (typeof oCol.mDataProp=='function' ? '{mDataprop function}' : "'"+oCol.mDataProp+"'")+ + " from the data source for row "+iRow ); oSettings.iDrawError = oSettings.iDraw; } return oCol.sDefaultContent; @@ -862,6 +866,10 @@ for ( var i=0, iLen=a.length-1 ; i/g, "" ); @@ -2315,10 +2329,6 @@ { return sData.replace(/[\r\n]/g," "); } - else if ( sData === null ) - { - return ''; - } return sData; } @@ -2381,57 +2391,41 @@ } var - iStart = oSettings._iDisplayStart+1, iEnd = oSettings.fnDisplayEnd(), - iMax = oSettings.fnRecordsTotal(), iTotal = oSettings.fnRecordsDisplay(), - sStart = oSettings.fnFormatNumber( iStart ), sEnd = oSettings.fnFormatNumber( iEnd ), - sMax = oSettings.fnFormatNumber( iMax ), sTotal = oSettings.fnFormatNumber( iTotal ), + oLang = oSettings.oLanguage, + iStart = oSettings._iDisplayStart+1, + iEnd = oSettings.fnDisplayEnd(), + iMax = oSettings.fnRecordsTotal(), + iTotal = oSettings.fnRecordsDisplay(), sOut; - /* When infinite scrolling, we are always starting at 1. _iDisplayStart is used only - * internally - */ - if ( oSettings.oScroll.bInfinite ) - { - sStart = oSettings.fnFormatNumber( 1 ); - } - - if ( oSettings.fnRecordsDisplay() === 0 && - oSettings.fnRecordsDisplay() == oSettings.fnRecordsTotal() ) + if ( iTotal === 0 && iTotal == iMax ) { /* Empty record set */ - sOut = oSettings.oLanguage.sInfoEmpty+ oSettings.oLanguage.sInfoPostFix; + sOut = oLang.sInfoEmpty; } - else if ( oSettings.fnRecordsDisplay() === 0 ) + else if ( iTotal === 0 ) { - /* Rmpty record set after filtering */ - sOut = oSettings.oLanguage.sInfoEmpty +' '+ - oSettings.oLanguage.sInfoFiltered.replace('_MAX_', sMax)+ - oSettings.oLanguage.sInfoPostFix; + /* Empty record set after filtering */ + sOut = oLang.sInfoEmpty +' '+ oLang.sInfoFiltered; } - else if ( oSettings.fnRecordsDisplay() == oSettings.fnRecordsTotal() ) + else if ( iTotal == iMax ) { /* Normal record set */ - sOut = oSettings.oLanguage.sInfo. - replace('_START_', sStart). - replace('_END_', sEnd). - replace('_TOTAL_', sTotal)+ - oSettings.oLanguage.sInfoPostFix; + sOut = oLang.sInfo; } else { /* Record set after filtering */ - sOut = oSettings.oLanguage.sInfo. - replace('_START_', sStart). - replace('_END_', sEnd). - replace('_TOTAL_', sTotal) +' '+ - oSettings.oLanguage.sInfoFiltered.replace('_MAX_', - oSettings.fnFormatNumber(oSettings.fnRecordsTotal()))+ - oSettings.oLanguage.sInfoPostFix; + sOut = oLang.sInfo +' '+ oLang.sInfoFiltered; } + + // Convert the macros + sOut += oLang.sInfoPostFix; + sOut = _fnInfoMacros( oSettings, sOut ); - if ( oSettings.oLanguage.fnInfoCallback !== null ) + if ( oLang.fnInfoCallback !== null ) { - sOut = oSettings.oLanguage.fnInfoCallback.call( oSettings.oInstance, + sOut = oLang.fnInfoCallback.call( oSettings.oInstance, oSettings, iStart, iEnd, iMax, iTotal, sOut ); } @@ -2443,6 +2437,33 @@ } + function _fnInfoMacros ( oSettings, str ) + { + var + iStart = oSettings._iDisplayStart+1, + sStart = oSettings.fnFormatNumber( iStart ), + iEnd = oSettings.fnDisplayEnd(), + sEnd = oSettings.fnFormatNumber( iEnd ), + iTotal = oSettings.fnRecordsDisplay(), + sTotal = oSettings.fnFormatNumber( iTotal ), + iMax = oSettings.fnRecordsTotal(), + sMax = oSettings.fnFormatNumber( iMax ); + + // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only + // internally + if ( oSettings.oScroll.bInfinite ) + { + sStart = oSettings.fnFormatNumber( 1 ); + } + + return str. + replace('_START_', sStart). + replace('_END_', sEnd). + replace('_TOTAL_', sTotal). + replace('_MAX_', sMax); + } + + /** * Draw the table for the first time, adding all required features @@ -2576,16 +2597,20 @@ */ function _fnLanguageCompat( oLanguage ) { + var oDefaults = DataTable.defaults.oLanguage; + /* Backwards compatibility - if there is no sEmptyTable given, then use the same as * sZeroRecords - assuming that is given. */ - if ( !oLanguage.sEmptyTable && oLanguage.sZeroRecords ) + if ( !oLanguage.sEmptyTable && oLanguage.sZeroRecords && + oDefaults.sEmptyTable === "No data available in table" ) { _fnMap( oLanguage, oLanguage, 'sZeroRecords', 'sEmptyTable' ); } /* Likewise with loading records */ - if ( !oLanguage.sLoadingRecords && oLanguage.sZeroRecords ) + if ( !oLanguage.sLoadingRecords && oLanguage.sZeroRecords && + oDefaults.sLoadingRecords === "Loading..." ) { _fnMap( oLanguage, oLanguage, 'sZeroRecords', 'sLoadingRecords' ); } @@ -2954,7 +2979,8 @@ nScrollHead.style.border = "0"; nScrollHead.style.width = "100%"; nScrollFoot.style.border = "0"; - nScrollHeadInner.style.width = "150%"; /* will be overwritten */ + nScrollHeadInner.style.width = oSettings.oScroll.sXInner !== "" ? + oSettings.oScroll.sXInner : "100%"; /* will be overwritten */ /* Modify attributes to respect the clones */ nScrollHeadTable.removeAttribute('id'); @@ -2966,11 +2992,20 @@ nScrollFootTable.style.marginLeft = "0"; } - /* Move any caption elements from the body to the header */ - var nCaptions = $(oSettings.nTable).children('caption'); - for ( var i=0, iLen=nCaptions.length ; i 0 ) { - nScrollHeadTable.appendChild( nCaptions[i] ); + nCaption = nCaption[0]; + if ( nCaption._captionSide === "top" ) + { + nScrollHeadTable.appendChild( nCaption ); + } + else if ( nCaption._captionSide === "bottom" && nTfoot ) + { + nScrollFootTable.appendChild( nCaption ); + } } /* @@ -3070,14 +3105,14 @@ /* Remove the old minimised thead and tfoot elements in the inner table */ $(o.nTable).children('thead, tfoot').remove(); - + /* Clone the current header and footer elements and then place it into the inner table */ - nTheadSize = o.nTHead.cloneNode(true); + nTheadSize = $(o.nTHead).clone()[0]; o.nTable.insertBefore( nTheadSize, o.nTable.childNodes[0] ); if ( o.nTFoot !== null ) { - nTfootSize = o.nTFoot.cloneNode(true); + nTfootSize = $(o.nTFoot).clone()[0]; o.nTable.insertBefore( nTfootSize, o.nTable.childNodes[1] ); } @@ -3108,6 +3143,14 @@ n.style.width = ""; }, nTfootSize.getElementsByTagName('tr') ); } + + // If scroll collapse is enabled, when we put the headers back into the body for sizing, we + // will end up forcing the scrollbar to appear, making our measurements wrong for when we + // then hide it (end of this function), so add the header height to the body scroller. + if ( o.oScroll.bCollapse && o.oScroll.sY !== "" ) + { + nScrollBody.style.height = (nScrollBody.offsetHeight + o.nTHead.offsetHeight)+"px"; + } /* Size the table as a whole */ iSanityWidth = $(o.nTable).outerWidth(); @@ -3292,7 +3335,7 @@ o.oScroll.iBarWidth : 0; if ( o.nTable.offsetHeight < nScrollBody.offsetHeight ) { - nScrollBody.style.height = _fnStringToCss( $(o.nTable).height()+iExtra ); + nScrollBody.style.height = _fnStringToCss( o.nTable.offsetHeight+iExtra ); } } @@ -3796,7 +3839,9 @@ sDataType = oSettings.aoColumns[ iColumn ].sSortDataType; if ( DataTable.ext.afnSortData[sDataType] ) { - var aData = DataTable.ext.afnSortData[sDataType]( oSettings, iColumn, iVisColumn ); + var aData = DataTable.ext.afnSortData[sDataType].call( + oSettings.oInstance, oSettings, iColumn, iVisColumn + ); if ( aData.length === aoData.length ) { for ( j=0, jLen=aoData.length ; j/g, "" ); nTh = aoColumns[i].nTh; nTh.removeAttribute('aria-sort'); nTh.removeAttribute('aria-label'); @@ -3907,18 +3953,18 @@ var nextSort = (aoColumns[i].asSorting[ aaSort[0][2]+1 ]) ? aoColumns[i].asSorting[ aaSort[0][2]+1 ] : aoColumns[i].asSorting[0]; - nTh.setAttribute('aria-label', aoColumns[i].sTitle+ + nTh.setAttribute('aria-label', sTitle+ (nextSort=="asc" ? oAria.sSortAscending : oAria.sSortDescending) ); } else { - nTh.setAttribute('aria-label', aoColumns[i].sTitle+ + nTh.setAttribute('aria-label', sTitle+ (aoColumns[i].asSorting[0]=="asc" ? oAria.sSortAscending : oAria.sSortDescending) ); } } else { - nTh.setAttribute('aria-label', aoColumns[i].sTitle); + nTh.setAttribute('aria-label', sTitle); } } @@ -5194,10 +5240,8 @@ /* Flag to note that the table is currently being destroyed - no action should be taken */ oSettings.bDestroying = true; - /* Restore hidden columns */ - for ( i=0, iLen=oSettings.aoDestroyCallback.length ; i