Fix a number of errors such as leaking variables and code stylepull/40/head
parent
4f29d7fda6
commit
4df671ed24
@ -1,19 +1,33 @@
|
|||||||
/**
|
/**
|
||||||
* When DataTables removes columns from the display (bVisible or
|
* When DataTables removes columns from the display (`bVisible` or
|
||||||
* fnSetColumnVis) it removes these elements from the DOM, effecting the
|
* `fnSetColumnVis`) it removes these elements from the DOM, effecting the index
|
||||||
* index value for the column positions. This function converts the data
|
* value for the column positions. This function converts the data column index
|
||||||
* column index (i.e. all columns regardless of visibility) into a visible
|
* (i.e. all columns regardless of visibility) into a visible column index.
|
||||||
* column index.
|
*
|
||||||
|
* DataTables 1.10+ has this ability built-in through the
|
||||||
|
* `dt-api column.index()` method. As such this method is marked deprecated, but
|
||||||
|
* is available for use with legacy version of DataTables.
|
||||||
*
|
*
|
||||||
* @name fnColumnIndexToVisible
|
* @name fnColumnIndexToVisible
|
||||||
* @summary
|
* @summary Convert a column data index to a visible index.
|
||||||
* @author [Allan Jardine](http://sprymedia.co.uk)
|
* @author [Allan Jardine](http://sprymedia.co.uk)
|
||||||
|
* @deprecated
|
||||||
|
*
|
||||||
|
* @param {integer} iMatch Column data index to convert to visible index
|
||||||
|
* @returns {integer} Visible column index
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
*
|
* var table = $('#example').dataTable( {
|
||||||
|
* aoColumnDefs: [
|
||||||
|
* { bVisible: false, aTargets: [1] }
|
||||||
|
* ]
|
||||||
|
* } );
|
||||||
|
*
|
||||||
|
* // This will show 1
|
||||||
|
* alert( 'Column 2 visible index: '+table.fnColumnIndexToVisible(2) );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$.fn.dataTableExt.oApi.fnColumnIndexToVisible = function ( oSettings, iMatch )
|
jQuery.fn.dataTableExt.oApi.fnColumnIndexToVisible = function ( oSettings, iMatch )
|
||||||
{
|
{
|
||||||
return oSettings.oApi._fnColumnIndexToVisible( oSettings, iMatch );
|
return oSettings.oApi._fnColumnIndexToVisible( oSettings, iMatch );
|
||||||
};
|
};
|
||||||
|
@ -1,23 +1,26 @@
|
|||||||
/**
|
/**
|
||||||
* When doing some heavy processing of your own (for example using fnOpen with
|
* When doing some heavy processing of your own (for example using fnOpen with
|
||||||
* data loading from the server) it can be useful to make use of the
|
* data loading from the server) it can be useful to make use of the
|
||||||
* 'processing' indicator built-into DataTables. This plug-in function
|
* 'processing' indicator built-into DataTables. This plug-in function exposes
|
||||||
* exposes the internal DataTables function so it can be used for exactly this.
|
* the internal DataTables function so it can be used for exactly this.
|
||||||
*
|
*
|
||||||
* @name fnProcessingIndicator
|
* @name fnProcessingIndicator
|
||||||
* @summary
|
* @summary Show and hide the DataTables processing element through the API.
|
||||||
* @author Allan Chappell
|
* @author Allan Chappell
|
||||||
*
|
*
|
||||||
|
* @param {boolean} [onoff=true] Show (`true`) or hide (`false`) the processing
|
||||||
|
* element.
|
||||||
|
*
|
||||||
* @example
|
* @example
|
||||||
* oTable.fnProcessingIndicator(); // On
|
* var table = $('#example').dataTable();
|
||||||
* oTable.fnProcessingIndicator(false); // Off
|
* table.fnProcessingIndicator(); // On
|
||||||
|
* table.fnProcessingIndicator(false); // Off
|
||||||
*/
|
*/
|
||||||
|
|
||||||
jQuery.fn.dataTableExt.oApi.fnProcessingIndicator = function ( oSettings, onoff )
|
jQuery.fn.dataTableExt.oApi.fnProcessingIndicator = function ( oSettings, onoff )
|
||||||
{
|
{
|
||||||
if( typeof(onoff) == 'undefined' )
|
if ( onoff === undefined ) {
|
||||||
{
|
onoff = true;
|
||||||
onoff=true;
|
|
||||||
}
|
}
|
||||||
this.oApi._fnProcessingDisplay( oSettings, onoff );
|
this.oApi._fnProcessingDisplay( oSettings, onoff );
|
||||||
};
|
};
|
||||||
|
@ -1,20 +1,38 @@
|
|||||||
/**
|
/**
|
||||||
* Jump to data
|
* It can be quite useful to jump straight to a page which contains a certain
|
||||||
|
* piece of data (a user name for example). This plug-in provides exactly that
|
||||||
|
* ability, searching for a given data parameter from a given column and
|
||||||
|
* immediately shifting the paging of the table to jump to that point.
|
||||||
|
*
|
||||||
|
* If multiple data points match the requested data, the paging will be shifted
|
||||||
|
* to show the first instance. If there are no matches, the paging will not
|
||||||
|
* change.
|
||||||
|
*
|
||||||
|
* Note that unlike the core DataTables API methods, this plug-in will
|
||||||
|
* automatically call `dt-api draw()` to redraw the table with the current page
|
||||||
|
* shown.
|
||||||
*
|
*
|
||||||
* @name page.JumpToData()
|
* @name page.JumpToData()
|
||||||
* @summary
|
* @summary Jump to a page by searching for data from a column
|
||||||
* @author [Allan Jardine](http://sprymedia.co.uk)
|
* @author [Allan Jardine](http://sprymedia.co.uk)
|
||||||
* @requires DataTables 1.10+
|
* @requires DataTables 1.10+
|
||||||
*
|
*
|
||||||
|
* @param {*} data Data to search for
|
||||||
|
* @param {integer} column Column index
|
||||||
|
* @returns {Api} DataTables API instance
|
||||||
|
*
|
||||||
* @example
|
* @example
|
||||||
|
* var table = $('#example').DataTable();
|
||||||
* table.page.jumpToData( 0, "Allan Jardine" );
|
* table.page.jumpToData( 0, "Allan Jardine" );
|
||||||
*/
|
*/
|
||||||
|
|
||||||
jQuery.fn.dataTable.Api.register( 'page.jumpToData()', function ( column, data ) {
|
jQuery.fn.dataTable.Api.register( 'page.jumpToData()', function ( data, column ) {
|
||||||
var pos = this.column(column, {order:'current'}).data().indexOf( data );
|
var pos = this.column(column, {order:'current'}).data().indexOf( data );
|
||||||
|
|
||||||
if ( pos >= 0 ) {
|
if ( pos >= 0 ) {
|
||||||
var page = Math.floor( pos / this.page.info().length );
|
var page = Math.floor( pos / this.page.info().length );
|
||||||
this.page( page ).draw( false );
|
this.page( page ).draw( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
} );
|
} );
|
Loading…
Reference in new issue