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
"offsetY": -1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"target": -1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"targetIndex": -1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"fromIndex": -1 }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Information which is used for positioning the insert cusor and knowing where to do the * insert. Array of objects with the properties: * x: x-axis position * to: insert point * @property aoTargets * @type array * @default [] */ "aoTargets": [] }; /** * @namespace Common and useful DOM elements for the class instance */ this.dom = { /** * Dragging element (the one the mouse is moving) * @property drag * @type element * @default null */ "drag": null
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * The insert cursor * @property pointer * @type element * @default null */ "pointer": null }; /* Constructor logic */ this.s.dt = oDTSettings; this.s.dt._colReorder = this; this._fnConstruct(); /* Add destroy callback */ oDTSettings.oApi._fnCallbackReg(oDTSettings
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
'aoDestroyCallback'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
$.proxy(this._fnDestroy
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
this)
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
'ColReorder'); return this; }; ColReorder.prototype = { /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Public methods * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** * Reset the column ordering to the original ordering that was detected on * start up. * @return {this} Returns `this` for chaining. * * @example * // DataTables initialisation with ColReorder * var table = $('#example').dataTable( { * "sDom": 'Rlfrtip' * } ); * * // Add click event to a button to reset the ordering * $('#resetOrdering').click( function (e) { * e.preventDefault(); * $.fn.dataTable.ColReorder( table ).fnReset(); * } ); */ "fnReset": function () { var a = []; for ( var i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ ) { a.push( this.s.dt.aoColumns[i]._ColReorder_iOrigCol ); } this._fnOrderColumns( a ); return this; }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * `Deprecated` - Get the current order of the columns
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
as an array. * @return {array} Array of column identifiers * @deprecated `fnOrder` should be used in preference to this method. * `fnOrder` acts as a getter/setter. */ "fnGetCurrentOrder": function () { return this.fnOrder(); }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Get the current order of the columns
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
as an array. Note that the values * given in the array are unique identifiers for each column. Currently * these are the original ordering of the columns that was detected on * start up
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
but this could potentially change in future. * @return {array} Array of column identifiers * * @example * // Get column ordering for the table * var order = $.fn.dataTable.ColReorder( dataTable ).fnOrder(); *//** * Set the order of the columns
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
from the positions identified in the * ordering array given. Note that ColReorder takes a brute force approach * to reordering
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
so it is possible multiple reordering events will occur * before the final order is settled upon. * @param {array} [set] Array of column identifiers in the new order. Note * that every column must be included
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
uniquely
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
in this array. * @return {this} Returns `this` for chaining. * * @example * // Swap the first and second columns * $.fn.dataTable.ColReorder( dataTable ).fnOrder( [1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
2
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
3
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
4] ); * * @example * // Move the first column to the end for the table `#example` * var curr = $.fn.dataTable.ColReorder( '#example' ).fnOrder(); * var first = curr.shift(); * curr.push( first ); * $.fn.dataTable.ColReorder( '#example' ).fnOrder( curr ); * * @example * // Reverse the table's order * $.fn.dataTable.ColReorder( '#example' ).fnOrder( * $.fn.dataTable.ColReorder( '#example' ).fnOrder().reverse() * ); */ "fnOrder": function ( set ) { if ( set === undefined ) { var a = []; for ( var i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ ) { a.push( this.s.dt.aoColumns[i]._ColReorder_iOrigCol ); } return a; } this._fnOrderColumns( fnInvertKeyValues( set ) ); return this; }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Private methods (they are of course public in JS
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
but recommended as private) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** * Constructor logic * @method _fnConstruct * @returns void * @private */ "_fnConstruct": function () { var that = this; var iLen = this.s.dt.aoColumns.length; var i; /* Columns discounted from reordering - counting left to right */ if ( this.s.init.iFixedColumns ) { this.s.fixed = this.s.init.iFixedColumns; } /* Columns discounted from reordering - counting right to left */ this.s.fixedRight = this.s.init.iFixedColumnsRight ? this.s.init.iFixedColumnsRight : 0; /* Drop callback initialisation option */ if ( this.s.init.fnReorderCallback ) { this.s.reorderCallback = this.s.init.fnReorderCallback; } /* Add event handlers for the drag and drop
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
and also mark the original column order */ for ( i = 0; i < iLen; i++ ) { if ( i > this.s.fixed-1 && i < iLen - this.s.fixedRight ) { this._fnMouseListener( i
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
this.s.dt.aoColumns[i].nTh ); } /* Mark the original column order for later reference */ this.s.dt.aoColumns[i]._ColReorder_iOrigCol = i; } /* State saving */ this.s.dt.oApi._fnCallbackReg( this.s.dt
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
'aoStateSaveParams'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
function (oS
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
oData) { that._fnStateSave.call( that
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
oData ); }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"ColReorder_State" ); /* An initial column order has been specified */ var aiOrder = null; if ( this.s.init.aiOrder ) { aiOrder = this.s.init.aiOrder.slice(); } /* State loading
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
overrides the column order given */ if ( this.s.dt.oLoadedState && typeof this.s.dt.oLoadedState.ColReorder != 'undefined' && this.s.dt.oLoadedState.ColReorder.length == this.s.dt.aoColumns.length ) { aiOrder = this.s.dt.oLoadedState.ColReorder; } /* If we have an order to apply - do so */ if ( aiOrder ) { /* We might be called during or after the DataTables initialisation. If before
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
then we need * to wait until the draw is done
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
if after
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
then do what we need to do right away */ if ( !that.s.dt._bInitComplete ) { var bDone = false; this.s.dt.aoDrawCallback.push( { "fn": function () { if ( !that.s.dt._bInitComplete && !bDone ) { bDone = true; var resort = fnInvertKeyValues( aiOrder ); that._fnOrderColumns.call( that
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
resort ); } }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"sName": "ColReorder_Pre" } ); } else { var resort = fnInvertKeyValues( aiOrder ); that._fnOrderColumns.call( that
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
resort ); } } else { this._fnSetColumnIndexes(); } }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Set the column order from an array * @method _fnOrderColumns * @param array a An array of integers which dictate the column order that should be applied * @returns void * @private */ "_fnOrderColumns": function ( a ) { if ( a.length != this.s.dt.aoColumns.length ) { this.s.dt.oInstance.oApi._fnLog( this.s.dt
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 - array reorder does not "+ "match known number of columns. Skipping." ); return; } for ( var i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=a.length ; i<iLen ; i++ ) { var currIndex = $.inArray( i
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
a ); if ( i != currIndex ) { /* Reorder our switching array */ fnArraySwitch( a
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
currIndex
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
i ); /* Do the column reorder in the table */ this.s.dt.oInstance.fnColReorder( currIndex
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
i ); } } /* When scrolling we need to recalculate the column sizes to allow for the shift */ if ( this.s.dt.oScroll.sX !== "" || this.s.dt.oScroll.sY !== "" ) { this.s.dt.oInstance.fnAdjustColumnSizing( false ); } /* Save the state */ this.s.dt.oInstance.oApi._fnSaveState( this.s.dt ); this._fnSetColumnIndexes(); if ( this.s.reorderCallback !== null ) { this.s.reorderCallback.call( this ); } }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Because we change the indexes of columns in the table
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
relative to their starting point * we need to reorder the state columns to what they are at the starting point so we can * then rearrange them again on state load! * @method _fnStateSave * @param object oState DataTables state * @returns string JSON encoded cookie string for DataTables * @private */ "_fnStateSave": function ( oState ) { 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
aCopy
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iOrigColumn; var oSettings = this.s.dt; var columns = oSettings.aoColumns; oState.ColReorder = []; /* Sorting */ if ( oState.aaSorting ) { // 1.10.0- for ( i=0 ; i<oState.aaSorting.length ; i++ ) { oState.aaSorting[i][0] = columns[ oState.aaSorting[i][0] ]._ColReorder_iOrigCol; } var aSearchCopy = $.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
oState.aoSearchCols ); for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=columns.length ; i<iLen ; i++ ) { iOrigColumn = columns[i]._ColReorder_iOrigCol; /* Column filter */ oState.aoSearchCols[ iOrigColumn ] = aSearchCopy[i]; /* Visibility */ oState.abVisCols[ iOrigColumn ] = columns[i].bVisible; /* Column reordering */ oState.ColReorder.push( iOrigColumn ); } } else if ( oState.order ) { // 1.10.1+ for ( i=0 ; i<oState.order.length ; i++ ) { oState.order[i][0] = columns[ oState.order[i][0] ]._ColReorder_iOrigCol; } var stateColumnsCopy = $.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
oState.columns ); for ( i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=columns.length ; i<iLen ; i++ ) { iOrigColumn = columns[i]._ColReorder_iOrigCol; /* Columns */ oState.columns[ iOrigColumn ] = stateColumnsCopy[i]; /* Column reordering */ oState.ColReorder.push( iOrigColumn ); } } }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Mouse drop and drag */ /** * Add a mouse down listener to a particluar TH element * @method _fnMouseListener * @param int i Column index * @param element nTh TH element clicked on * @returns void * @private */ "_fnMouseListener": function ( i
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
nTh ) { var that = this; $(nTh).on( 'mousedown.ColReorder'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
function (e) { e.preventDefault(); that._fnMouseDown.call( that
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
e
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
nTh ); } ); }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Mouse down on a TH element in the table header * @method _fnMouseDown * @param event e Mouse event * @param element nTh TH element to be dragged * @returns void * @private */ "_fnMouseDown": function ( e
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
nTh ) { var that = this; /* Store information about the mouse position */ var target = $(e.target).closest('th
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
td'); var offset = target.offset(); var idx = parseInt( $(nTh).attr('data-column-index')
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
10 ); if ( idx === undefined ) { return; } this.s.mouse.startX = e.pageX; this.s.mouse.startY = e.pageY; this.s.mouse.offsetX = e.pageX - offset.left; this.s.mouse.offsetY = e.pageY - offset.top; this.s.mouse.target = this.s.dt.aoColumns[ idx ].nTh;//target[0]; this.s.mouse.targetIndex = idx; this.s.mouse.fromIndex = idx; this._fnRegions(); /* Add event handlers to the document */ $(document) .on( 'mousemove.ColReorder'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
function (e) { that._fnMouseMove.call( that
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
e ); } ) .on( 'mouseup.ColReorder'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
function (e) { that._fnMouseUp.call( that
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
e ); } ); }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Deal with a mouse move event while dragging a node * @method _fnMouseMove * @param event e Mouse event * @returns void * @private */ "_fnMouseMove": function ( e ) { var that = this; if ( this.dom.drag === null ) { /* Only create the drag element if the mouse has moved a specific distance from the start * point - this allows the user to make small mouse movements when sorting and not have a * possibly confusing drag element showing up */ if ( Math.pow( Math.pow(e.pageX - this.s.mouse.startX
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
2) + Math.pow(e.pageY - this.s.mouse.startY
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
2)
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
0.5 ) < 5 ) { return; } this._fnCreateDragNode(); } /* Position the element - we respect where in the element the click occured */ this.dom.drag.css( { left: e.pageX - this.s.mouse.offsetX
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
top: e.pageY - this.s.mouse.offsetY } ); /* Based on the current mouse position
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
calculate where the insert should go */ var bSet = false; var lastToIndex = this.s.mouse.toIndex; for ( var i=1
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=this.s.aoTargets.length ; i<iLen ; i++ ) { if ( e.pageX < this.s.aoTargets[i-1].x + ((this.s.aoTargets[i].x-this.s.aoTargets[i-1].x)/2) ) { this.dom.pointer.css( 'left'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
this.s.aoTargets[i-1].x ); this.s.mouse.toIndex = this.s.aoTargets[i-1].to; bSet = true; break; } } // The insert element wasn't positioned in the array (less than // operator)
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
so we put it at the end if ( !bSet ) { this.dom.pointer.css( 'left'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
this.s.aoTargets[this.s.aoTargets.length-1].x ); this.s.mouse.toIndex = this.s.aoTargets[this.s.aoTargets.length-1].to; } // Perform reordering if realtime updating is on and the column has moved if ( this.s.init.bRealtime && lastToIndex !== this.s.mouse.toIndex ) { this.s.dt.oInstance.fnColReorder( this.s.mouse.fromIndex
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
this.s.mouse.toIndex ); this.s.mouse.fromIndex = this.s.mouse.toIndex; this._fnRegions(); } }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Finish off the mouse drag and insert the column where needed * @method _fnMouseUp * @param event e Mouse event * @returns void * @private */ "_fnMouseUp": function ( e ) { var that = this; $(document).off( 'mousemove.ColReorder mouseup.ColReorder' ); if ( this.dom.drag !== null ) { /* Remove the guide elements */ this.dom.drag.remove(); this.dom.pointer.remove(); this.dom.drag = null; this.dom.pointer = null; /* Actually do the reorder */ this.s.dt.oInstance.fnColReorder( this.s.mouse.fromIndex
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
this.s.mouse.toIndex ); this._fnSetColumnIndexes(); /* When scrolling we need to recalculate the column sizes to allow for the shift */ if ( this.s.dt.oScroll.sX !== "" || this.s.dt.oScroll.sY !== "" ) { this.s.dt.oInstance.fnAdjustColumnSizing( false ); } /* Save the state */ this.s.dt.oInstance.oApi._fnSaveState( this.s.dt ); if ( this.s.reorderCallback !== null ) { this.s.reorderCallback.call( this ); } } }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Calculate a cached array with the points of the column inserts
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
and the * 'to' points * @method _fnRegions * @returns void * @private */ "_fnRegions": function () { var aoColumns = this.s.dt.aoColumns; this.s.aoTargets.splice( 0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
this.s.aoTargets.length ); this.s.aoTargets.push( { "x": $(this.s.dt.nTable).offset().left
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"to": 0 } ); var iToPoint = 0; for ( var i=0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
iLen=aoColumns.length ; i<iLen ; i++ ) { /* For the column / header in question
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
we want it's position to remain the same if the * position is just to it's immediate left or right
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
so we only incremement the counter for * other columns */ if ( i != this.s.mouse.fromIndex ) { iToPoint++; } if ( aoColumns[i].bVisible ) { this.s.aoTargets.push( { "x": $(aoColumns[i].nTh).offset().left + $(aoColumns[i].nTh).outerWidth()
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
"to": iToPoint } ); } } /* Disallow columns for being reordered by drag and drop
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
counting right to left */ if ( this.s.fixedRight !== 0 ) { this.s.aoTargets.splice( this.s.aoTargets.length - this.s.fixedRight ); } /* Disallow columns for being reordered by drag and drop
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
counting left to right */ if ( this.s.fixed !== 0 ) { this.s.aoTargets.splice( 0
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
this.s.fixed ); } }
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
/** * Copy the TH element that is being drags so the user has the idea that they are actually * moving it around the page. * @method _fnCreateDragNode * @returns void * @private */ "_fnCreateDragNode": function () { var scrolling = this.s.dt.oScroll.sX !== "" || this.s.dt.oScroll.sY !== ""; var origCell = this.s.dt.aoColumns[ this.s.mouse.targetIndex ].nTh; var origTr = origCell.parentNode; var origThead = origTr.parentNode; var origTable = origThead.parentNode; var cloneCell = $(origCell).clone(); // This is a slightly odd combination of jQuery and DOM
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
but it is the // fastest and least resource intensive way I could think of cloning // the table with just a single header cell in it. this.dom.drag = $(origTable.cloneNode(false)) .addClass( 'DTCR_clonedTable' ) .append( $(origThead.cloneNode(false)).append( $(origTr.cloneNode(false)).append( cloneCell[0] ) ) ) .css( { position: 'absolute'
miguelacosta84_NEAR-lista-de-precios_web_public_datatables_new_extensions_ColReorder_js_dataTables.colReorder.js
javascript
top: 0