filename
stringlengths
20
188
language
stringclasses
3 values
AST-segments
stringlengths
0
204k
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ) { var anTags = []; for ( var i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=nParent.childNodes.length ; i<iLen ; i++ ) { if ( nParent.childNodes[i].nodeType == 1 ) { anTags.push( nParent.childNodes[i] ); } } var nStore = anTags[ iFrom ]; if ( iTo !== null ) { nParent.insertBefore( nStore
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
anTags[iTo] ); } else { nParent.appendChild( nStore ); } } var factory = function( $
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
DataTable ) { "use strict"; /** * Plug-in for DataTables which will reorder the internal column structure by taking the column * from one position (iFrom) and insert it into a given point (iTo). * @method $.fn.dataTableExt.oApi.fnColReorder * @param object oSettings DataTables settings object - automatically added by DataTables! * @param int iFrom Take the column to be repositioned from this point * @param int iTo and insert it into this point * @returns void */ $.fn.dataTableExt.oApi.fnColReorder = function ( oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ) { var v110 = $.fn.dataTable.Api ? true : false; var i
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
j
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
jLen
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iCols=oSettings.aoColumns.length
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
nTrs
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
oCol; var attrMap = function ( obj
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
prop
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
mapping ) { if ( ! obj[ prop ] ) { return; } var a = obj[ prop ].split('.'); var num = a.shift(); if ( isNaN( num*1 ) ) { return; } obj[ prop ] = mapping[ num*1 ]+'.'+a.join('.'); }; /* Sanity check in the input */ if ( iFrom == iTo ) { /* Pointless reorder */ return; } if ( iFrom < 0 || iFrom >= iCols ) { this.oApi._fnLog( oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"ColReorder 'from' index is out of bounds: "+iFrom ); return; } if ( iTo < 0 || iTo >= iCols ) { this.oApi._fnLog( oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"ColReorder 'to' index is out of bounds: "+iTo ); return; } /* * Calculate the new column array index
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
so we have a mapping between the old and new */ var aiMapping = []; for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=iCols ; i<iLen ; i++ ) { aiMapping[i] = i; } fnArraySwitch( aiMapping
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); var aiInvertMapping = fnInvertKeyValues( aiMapping ); /* * Convert all internal indexing to the new column order indexes */ /* Sorting */ for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=oSettings.aaSorting.length ; i<iLen ; i++ ) { oSettings.aaSorting[i][0] = aiInvertMapping[ oSettings.aaSorting[i][0] ]; } /* Fixed sorting */ if ( oSettings.aaSortingFixed !== null ) { for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=oSettings.aaSortingFixed.length ; i<iLen ; i++ ) { oSettings.aaSortingFixed[i][0] = aiInvertMapping[ oSettings.aaSortingFixed[i][0] ]; } } /* Data column sorting (the column which the sort for a given column should take place on) */ for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=iCols ; i<iLen ; i++ ) { oCol = oSettings.aoColumns[i]; for ( j=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
jLen=oCol.aDataSort.length ; j<jLen ; j++ ) { oCol.aDataSort[j] = aiInvertMapping[ oCol.aDataSort[j] ]; } // Update the column indexes if ( v110 ) { oCol.idx = aiInvertMapping[ oCol.idx ]; } } if ( v110 ) { // Update 1.10 optimised sort class removal variable $.each( oSettings.aLastSort
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
function (i
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
val) { oSettings.aLastSort[i].src = aiInvertMapping[ val.src ]; } ); } /* Update the Get and Set functions for each column */ for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=iCols ; i<iLen ; i++ ) { oCol = oSettings.aoColumns[i]; if ( typeof oCol.mData == 'number' ) { oCol.mData = aiInvertMapping[ oCol.mData ]; // regenerate the get / set functions oSettings.oApi._fnColumnOptions( oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
i
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
{} ); } else if ( $.isPlainObject( oCol.mData ) ) { // HTML5 data sourced attrMap( oCol.mData
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
'_'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
aiInvertMapping ); attrMap( oCol.mData
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
'filter'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
aiInvertMapping ); attrMap( oCol.mData
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
'sort'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
aiInvertMapping ); attrMap( oCol.mData
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
'type'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
aiInvertMapping ); // regenerate the get / set functions oSettings.oApi._fnColumnOptions( oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
i
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
{} ); } } /* * Move the DOM elements */ if ( oSettings.aoColumns[iFrom].bVisible ) { /* Calculate the current visible index and the point to insert the node before. The insert * before needs to take into account that there might not be an element to insert before
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
* in which case it will be null
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
and an appendChild should be used */ var iVisibleIndex = this.oApi._fnColumnIndexToVisible( oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom ); var iInsertBeforeIndex = null; i = iTo < iFrom ? iTo : iTo + 1; while ( iInsertBeforeIndex === null && i < iCols ) { iInsertBeforeIndex = this.oApi._fnColumnIndexToVisible( oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
i ); i++; } /* Header */ nTrs = oSettings.nTHead.getElementsByTagName('tr'); for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=nTrs.length ; i<iLen ; i++ ) { fnDomSwitch( nTrs[i]
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iVisibleIndex
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iInsertBeforeIndex ); } /* Footer */ if ( oSettings.nTFoot !== null ) { nTrs = oSettings.nTFoot.getElementsByTagName('tr'); for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=nTrs.length ; i<iLen ; i++ ) { fnDomSwitch( nTrs[i]
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iVisibleIndex
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iInsertBeforeIndex ); } } /* Body */ for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=oSettings.aoData.length ; i<iLen ; i++ ) { if ( oSettings.aoData[i].nTr !== null ) { fnDomSwitch( oSettings.aoData[i].nTr
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iVisibleIndex
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iInsertBeforeIndex ); } } } /* * Move the internal array elements */ /* Columns */ fnArraySwitch( oSettings.aoColumns
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); /* Search columns */ fnArraySwitch( oSettings.aoPreSearchCols
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); /* Array array - internal data anodes cache */ for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=oSettings.aoData.length ; i<iLen ; i++ ) { var data = oSettings.aoData[i]; if ( v110 ) { // DataTables 1.10+ if ( data.anCells ) { fnArraySwitch( data.anCells
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); } // For DOM sourced data
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
the invalidate will reread the cell into // the data array
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
but for data sources as an array
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
they need to // be flipped if ( data.src !== 'dom' && $.isArray( data._aData ) ) { fnArraySwitch( data._aData
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); } } else { // DataTables 1.9- if ( $.isArray( data._aData ) ) { fnArraySwitch( data._aData
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); } fnArraySwitch( data._anHidden
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); } } /* Reposition the header elements in the header layout array */ for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=oSettings.aoHeader.length ; i<iLen ; i++ ) { fnArraySwitch( oSettings.aoHeader[i]
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); } if ( oSettings.aoFooter !== null ) { for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=oSettings.aoFooter.length ; i<iLen ; i++ ) { fnArraySwitch( oSettings.aoFooter[i]
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iTo ); } } // In 1.10 we need to invalidate row cached data for sorting
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
filtering etc if ( v110 ) { var api = new $.fn.dataTable.Api( oSettings ); api.rows().invalidate(); } /* * Update DataTables' event handlers */ /* Sort listener */ for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=iCols ; i<iLen ; i++ ) { $(oSettings.aoColumns[i].nTh).off('click.DT'); this.oApi._fnSortAttachListener( oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
oSettings.aoColumns[i].nTh
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
i ); } /* Fire an event so other plug-ins can update */ $(oSettings.oInstance).trigger( 'column-reorder'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
[ oSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
{ "iFrom": iFrom
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"iTo": iTo
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"aiInvertMapping": aiInvertMapping } ] ); }; /** * ColReorder provides column visibility control for DataTables * @class ColReorder * @constructor * @param {object} dt DataTables settings object * @param {object} opts ColReorder options */ var ColReorder = function( dt
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
opts ) { var oDTSettings; if ( $.fn.dataTable.Api ) { oDTSettings = new $.fn.dataTable.Api( dt ).settings()[0]; } // 1.9 compatibility else if ( dt.fnSettings ) { // DataTables object
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
convert to the settings object oDTSettings = dt.fnSettings(); } else if ( typeof dt === 'string' ) { // jQuery selector if ( $.fn.dataTable.fnIsDataTable( $(dt)[0] ) ) { oDTSettings = $(dt).eq(0).dataTable().fnSettings(); } } else if ( dt.nodeName && dt.nodeName.toLowerCase() === 'table' ) { // Table node if ( $.fn.dataTable.fnIsDataTable( dt.nodeName ) ) { oDTSettings = $(dt.nodeName).dataTable().fnSettings(); } } else if ( dt instanceof jQuery ) { // jQuery object if ( $.fn.dataTable.fnIsDataTable( dt[0] ) ) { oDTSettings = dt.eq(0).dataTable().fnSettings(); } } else { // DataTables settings object oDTSettings = dt; } // Ensure that we can't initialise on the same table twice if ( oDTSettings._colReorder ) { throw "ColReorder already initialised on table #"+oDTSettings.nTable.id; } // Convert from camelCase to Hungarian
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
just as DataTables does var camelToHungarian = $.fn.dataTable.camelToHungarian; if ( camelToHungarian ) { camelToHungarian( ColReorder.defaults
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
ColReorder.defaults
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
true ); camelToHungarian( ColReorder.defaults
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
opts || {} ); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Public class variables * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** * @namespace Settings object which contains customisable information for ColReorder instance */ this.s = { /** * DataTables settings object * @property dt * @type Object * @default null */ "dt": null
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Initialisation object used for this instance * @property init * @type object * @default {} */ "init": $.extend( true
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
{}
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
ColReorder.defaults
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
opts )
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Number of columns to fix (not allow to be reordered) * @property fixed * @type int * @default 0 */ "fixed": 0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Number of columns to fix counting from right (not allow to be reordered) * @property fixedRight * @type int * @default 0 */ "fixedRight": 0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Callback function for once the reorder has been done * @property reorderCallback * @type function * @default null */ "reorderCallback": null
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * @namespace Information used for the mouse drag */ "mouse": { "startX": -1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"startY": -1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"offsetX": -1