var i=0, iLen, j, jLen, k, kLen; var sId = this.getAttribute( 'id' ); var bInitHandedOff = false; var bUsePassedData = false; /* Sanity check */ if ( this.nodeName.toLowerCase() != 'table' ) { _fnLog( null, 0, "Attempted to initialise DataTables on a node which is not a "+ "table: "+this.nodeName ); return; } /* Check to see if we are re-initialising a table */ for ( i=0, iLen=DataTable.settings.length ; i= oSettings.aoColumns.length ) { oSettings.aaSorting[i][0] = 0; } var oColumn = oSettings.aoColumns[ oSettings.aaSorting[i][0] ]; /* Add a default sorting index */ if ( oSettings.aaSorting[i][2] === undefined ) { oSettings.aaSorting[i][2] = 0; } /* If aaSorting is not defined, then we use the first indicator in asSorting */ if ( oInit.aaSorting === undefined && oSettings.saved_aaSorting === undefined ) { oSettings.aaSorting[i][1] = oColumn.asSorting[0]; } /* Set the current sorting index based on aoColumns.asSorting */ for ( j=0, jLen=oColumn.asSorting.length ; j 0 && (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) { // If we are a scrolling table, and no footer has been given, then we need to create // a tfoot element for the caption element to be appended to tfoot = [ document.createElement( 'tfoot' ) ]; this.appendChild( tfoot[0] ); } if ( tfoot.length > 0 ) { oSettings.nTFoot = tfoot[0]; _fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot ); } /* Check if there is data passing into the constructor */ if ( bUsePassedData ) { for ( i=0 ; i