Major update to doc comment formatting for new DataTables web-site

Also correct a load of JS errors such as leaking variables and use
consistent formatting.
pull/40/head
Allan Jardine 11 years ago
parent 0ab60d10ee
commit 4f29d7fda6

@ -1,6 +1,8 @@
/**
* Average the values in a data set.
*
* @name average()
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*

@ -6,9 +6,10 @@
* This function is a drop in replacement for fnAddData with one important
* exception, it will only take a 1D array or an object, and not a 2D array
* (i.e. it will not add multiple rows like fnAddData).
*
* @name fnAddDataAndDisplay
* @anchor fnAddDataAndDisplay
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -17,7 +18,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnAddDataAndDisplay = function ( oSettings, aData )
jQuery.fn.dataTableExt.oApi.fnAddDataAndDisplay = function ( oSettings, aData )
{
/* Add the data */
var iAdded = this.oApi._fnAddData( oSettings, aData );

@ -1,15 +1,16 @@
/**
* Take a TR element and add it to a DataTables table. Useful for maintaining
* custom classes and other attributes.
*
* @name fnAddTr
* @anchor fnAddTr
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) {
jQuery.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) {
if ( typeof bRedraw == 'undefined' )
{
bRedraw = true;
@ -24,7 +25,8 @@ $.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) {
var aData = [];
var aInvisible = [];
for ( var i=0 ; i<nTds.length ; i++ )
var i;
for ( i=0 ; i<nTds.length ; i++ )
{
aData.push( nTds[i].innerHTML );
if (!oSettings.aoColumns[i].bVisible)
@ -41,7 +43,7 @@ $.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) {
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();
// Hidding invisible columns
for ( var i = (aInvisible.length - 1) ; i >= 0 ; i-- )
for ( i = (aInvisible.length - 1) ; i >= 0 ; i-- )
{
oSettings.aoData[iIndex]._anHidden[ i ] = nTds[aInvisible[i]];
nTr.removeChild( nTds[aInvisible[i]] );

@ -4,9 +4,10 @@
* index value for the column positions. This function converts the data
* column index (i.e. all columns regardless of visibility) into a visible
* column index.
*
* @name fnColumnIndexToVisible
* @anchor fnColumnIndexToVisible
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
*

@ -1,18 +1,19 @@
/**
* Update the internal data for a TR element based on what is used in the
* DOM. You will likely want to call fnDraw() after this function.
*
* @name fnDataUpdate
* @anchor fnDataUpdate
* @summary
* @author Lior Gerson
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnDataUpdate = function ( oSettings, nRowObject, iRowIndex )
jQuery.fn.dataTableExt.oApi.fnDataUpdate = function ( oSettings, nRowObject, iRowIndex )
{
$(nRowObject).find("TD").each( function(i) {
jQuery(nRowObject).find("TD").each( function(i) {
var iColIndex = oSettings.oApi._fnVisibleToColumnIndex( oSettings, i );
oSettings.oApi._fnSetCellData( oSettings, iRowIndex, iColIndex, $(this).html() );
oSettings.oApi._fnSetCellData( oSettings, iRowIndex, iColIndex, jQuery(this).html() );
} );
};

@ -1,8 +1,9 @@
/**
* Take a TR element and alter the table's paging to show the TR in question.
*
* @name fnDisplayRow
* @anchor fnDisplayRow
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -12,7 +13,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnDisplayRow = function ( oSettings, nRow )
jQuery.fn.dataTableExt.oApi.fnDisplayRow = function ( oSettings, nRow )
{
// Account for the "display" all case - row is already displayed
if ( oSettings._iDisplayLength == -1 )

@ -1,15 +1,16 @@
/**
* Set the point at which DataTables will start it's display of data in the
* table.
*
* @name fnDisplayStart
* @anchor fnDisplayStart
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnDisplayStart = function ( oSettings, iStart, bRedraw )
jQuery.fn.dataTableExt.oApi.fnDisplayStart = function ( oSettings, iStart, bRedraw )
{
if ( typeof bRedraw == 'undefined' )
{

@ -1,17 +1,18 @@
/**
* Creates rowspan cells in a column when there are two or more cells in a
* row with the same content, effectively grouping them together visually.
* <b>Note</b> - this plug-in currently only operates correctly with
* <b>server-side processing</b>.
* *Note* - this plug-in currently only operates correctly with
* *server-side processing*.
*
* @name fnFakeRowspan
* @anchor fnFakeRowspan
* @summary
* @author Fredrik Wendel
*
* @example
* $('#example').dataTable().fnFakeRowspan(3);
*/
$.fn.dataTableExt.oApi.fnFakeRowspan = function ( oSettings, iColumn, bCaseSensitive ) {
jQuery.fn.dataTableExt.oApi.fnFakeRowspan = function ( oSettings, iColumn, bCaseSensitive ) {
/* Fail silently on missing/errorenous parameter data. */
if (isNaN(iColumn)) {
return false;
@ -22,11 +23,7 @@ $.fn.dataTableExt.oApi.fnFakeRowspan = function ( oSettings, iColumn, bCaseSensi
return false;
}
var oSettings = oSettings,
iColumn = iColumn,
bCaseSensitive = (typeof(bCaseSensitive) != 'boolean' ? true : bCaseSensitive);
oSettings.aoDrawCallback.push({ "fn": fakeRowspan, "sName": "fnFakeRowspan" });
bCaseSensitive = (typeof(bCaseSensitive) != 'boolean' ? true : bCaseSensitive);
function fakeRowspan () {
var firstOccurance = null,
@ -57,5 +54,7 @@ $.fn.dataTableExt.oApi.fnFakeRowspan = function ( oSettings, iColumn, bCaseSensi
});
}
oSettings.aoDrawCallback.push({ "fn": fakeRowspan, "sName": "fnFakeRowspan" });
return this;
};

@ -2,9 +2,10 @@
* Apply the same filter to all DataTable instances on a particular page. The
* function call exactly matches that used by fnFilter() so regular expression
* and individual column sorting can be used.
*
* @name fnFilterAll
* @anchor fnFilterAll
* @author <a href="http://www.kmmtiming.se/">Kristoffer Karlström</a>
* @summary
* @author [Kristoffer Karlström](http://www.kmmtiming.se/)
*
* @example
* $(document).ready(function() {
@ -17,7 +18,7 @@
* });
*/
$.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bRegex, bSmart) {
jQuery.fn.dataTableExt.oApi.fnFilterAll = function(oSettings, sInput, iColumn, bRegex, bSmart) {
var settings = $.fn.dataTableSettings;
for ( var i=0 ; i<settings.length ; i++ ) {

@ -1,9 +1,10 @@
/**
* Remove all filtering that has been applied to a DataTable, be it column
* based filtering or global filtering.
*
* @name fnFilterClear
* @anchor fnFilterClear
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -18,8 +19,10 @@
* } );
*/
$.fn.dataTableExt.oApi.fnFilterClear = function ( oSettings )
jQuery.fn.dataTableExt.oApi.fnFilterClear = function ( oSettings )
{
var i, iLen;
/* Remove global filter */
oSettings.oPreviousSearch.sSearch = "";
@ -27,7 +30,7 @@ $.fn.dataTableExt.oApi.fnFilterClear = function ( oSettings )
if ( typeof oSettings.aanFeatures.f != 'undefined' )
{
var n = oSettings.aanFeatures.f;
for ( var i=0, iLen=n.length ; i<iLen ; i++ )
for ( i=0, iLen=n.length ; i<iLen ; i++ )
{
$('input', n[i]).val( '' );
}
@ -36,7 +39,7 @@ $.fn.dataTableExt.oApi.fnFilterClear = function ( oSettings )
/* Remove the search text for the column filters - NOTE - if you have input boxes for these
* filters, these will need to be reset
*/
for ( var i=0, iLen=oSettings.aoPreSearchCols.length ; i<iLen ; i++ )
for ( i=0, iLen=oSettings.aoPreSearchCols.length ; i<iLen ; i++ )
{
oSettings.aoPreSearchCols[i].sSearch = "";
}

@ -2,9 +2,10 @@
* This plug-in removed the default behaviour of DataTables to filter on each
* keypress, and replaces with it the requirement to press the enter key to
* perform the filter.
*
* @name fnFilterOnReturn
* @anchor fnFilterOnReturn
* @author <a href="http://www.mvccms.com/">Jon Ranes</a>
* @summary
* @author [Jon Ranes](http://www.mvccms.com/)
*
* @example
* $(document).ready(function() {

@ -3,9 +3,10 @@
* can be restricted to a single column). The return value is an array with
* the data indexes (from DataTables' internal data store) for any rows which
* match.
*
* @name fnFindCellRowIndexes
* @anchor fnFindCellRowIndexes
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -17,7 +18,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnFindCellRowIndexes = function ( oSettings, sSearch, iColumn )
jQuery.fn.dataTableExt.oApi.fnFindCellRowIndexes = function ( oSettings, sSearch, iColumn )
{
var
i,iLen, j, jLen,
@ -45,4 +46,3 @@ $.fn.dataTableExt.oApi.fnFindCellRowIndexes = function ( oSettings, sSearch, iCo
return aOut;
};

@ -3,9 +3,10 @@
* matching data (optionally the search can be restricted to a single column),
* but in this case the returned array contains TR nodes of the matching rows,
* rather than data indexes.
*
* @name fnFindCellRowNodes
* @anchor fnFindCellRowNodes
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -17,7 +18,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnFindCellRowNodes = function ( oSettings, sSearch, iColumn )
jQuery.fn.dataTableExt.oApi.fnFindCellRowNodes = function ( oSettings, sSearch, iColumn )
{
var
i,iLen, j, jLen,

@ -6,9 +6,10 @@
* situation. It takes two parameters, the target node, and a boolean
* indicating if the adjacent row retrieved should be the next (true, or no
* value) or the previous (false).
*
* @name fnGetAdjacentTr
* @anchor fnGetAdjacentTr
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -20,7 +21,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnGetAdjacentTr = function ( oSettings, nTr, bNext )
jQuery.fn.dataTableExt.oApi.fnGetAdjacentTr = function ( oSettings, nTr, bNext )
{
/* Find the node's position in the aoData store */
var iCurrent = oSettings.oApi._fnNodeToDataIndex( oSettings, nTr );

@ -1,9 +1,10 @@
/**
* Return an array of table values from a particular column, with various
* filtering options.
*
* @name fnGetColumnData
* @anchor fnGetColumnData
* @author <a href="http://mind2.de">Benedikt Forchhammer</a>
* @summary
* @author [Benedikt Forchhammer](http://mind2.de)
*
* @example
*
@ -11,40 +12,58 @@
jQuery.fn.dataTableExt.oApi.fnGetColumnData = function ( oSettings, iColumn, bUnique, bFiltered, bIgnoreEmpty ) {
// check that we have a column id
if ( typeof iColumn == "undefined" ) return [];
if ( typeof iColumn == "undefined" ) {
return [];
}
// by default we only wany unique data
if ( typeof bUnique == "undefined" ) bUnique = true;
if ( typeof bUnique == "undefined" ) {
bUnique = true;
}
// by default we do want to only look at filtered data
if ( typeof bFiltered == "undefined" ) bFiltered = true;
if ( typeof bFiltered == "undefined" ) {
bFiltered = true;
}
// by default we do not wany to include empty values
if ( typeof bIgnoreEmpty == "undefined" ) bIgnoreEmpty = true;
if ( typeof bIgnoreEmpty == "undefined" ) {
bIgnoreEmpty = true;
}
// list of rows which we're going to loop through
var aiRows;
// use only filtered rows
if (bFiltered == true) aiRows = oSettings.aiDisplay;
if (bFiltered === true) {
aiRows = oSettings.aiDisplay;
}
// use all rows
else aiRows = oSettings.aiDisplayMaster; // all row numbers
else {
aiRows = oSettings.aiDisplayMaster; // all row numbers
}
// set up data array
var asResultData = new Array();
var asResultData = [];
for (var i=0,c=aiRows.length; i<c; i++) {
iRow = aiRows[i];
var iRow = aiRows[i];
var sValue = this.fnGetData(iRow, iColumn);
// ignore empty values?
if (bIgnoreEmpty == true && sValue.length == 0) continue;
if (bIgnoreEmpty === true && sValue.length === 0) {
continue;
}
// ignore unique values?
else if (bUnique == true && jQuery.inArray(sValue, asResultData) > -1) continue;
else if (bUnique === true && jQuery.inArray(sValue, asResultData) > -1) {
continue;
}
// else push the value onto the result data array
else asResultData.push(sValue);
else {
asResultData.push(sValue);
}
}
return asResultData;

@ -4,15 +4,16 @@
* needs to change due to an added or removed column. This plug-in function
* will match a given string to the title of a column in the table and return
* the column index, helping to overcome this problem.
*
* @name fnGetColumnIndex
* @anchor fnGetColumnIndex
* @author <a href="http://www.rosstechassociates.com/">Michael Ross</a>
* @summary
* @author [Michael Ross](http://www.rosstechassociates.com/)
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnGetColumnIndex = function ( oSettings, sCol )
jQuery.fn.dataTableExt.oApi.fnGetColumnIndex = function ( oSettings, sCol )
{
var cols = oSettings.aoColumns;
for ( var x=0, xLen=cols.length ; x<xLen ; x++ )
@ -20,7 +21,7 @@ $.fn.dataTableExt.oApi.fnGetColumnIndex = function ( oSettings, sCol )
if ( cols[x].sTitle.toLowerCase() == sCol.toLowerCase() )
{
return x;
};
}
}
return -1;
};

@ -1,19 +1,20 @@
/**
* Get a list of all TR nodes in the table which are not currently visible
* (useful for building forms).
*
* @name fnGetHiddenNodes
* @anchor fnGetHiddenNodes
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*/
$.fn.dataTableExt.oApi.fnGetHiddenNodes = function ( settings )
jQuery.fn.dataTableExt.oApi.fnGetHiddenNodes = function ( settings )
{
var nodes;
var display = $('tbody tr', settings.nTable);
var display = jQuery('tbody tr', settings.nTable);
if ( $.fn.dataTable.versionCheck ) {
if ( jQuery.fn.dataTable.versionCheck ) {
// DataTables 1.10
var api = new $.fn.dataTable.Api( settings );
var api = new jQuery.fn.dataTable.Api( settings );
nodes = api.rows().nodes().toArray();
}
else {

@ -4,9 +4,10 @@
* DOM methods, jQuery or whatever, it becomes a lot more complicated when
* taking into account hidden rows and columns. This function can be used to
* overcome these difficulties.
*
* @name fnGetTd
* @anchor fnGetTd
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -18,7 +19,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnGetTd = function ( oSettings, mTr, iTd, bVisOnly )
jQuery.fn.dataTableExt.oApi.fnGetTd = function ( oSettings, mTr, iTd, bVisOnly )
{
/* Take either a TR node or aoData index as the mTr property */
var iRow = (typeof mTr == 'object') ?

@ -1,9 +1,10 @@
/**
* Get an array of TD nodes from DataTables for a given row, including any
* column elements which are hidden.
*
* @name fnGetTds
* @anchor fnGetTds
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -15,7 +16,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnGetTds = function ( oSettings, mTr )
jQuery.fn.dataTableExt.oApi.fnGetTds = function ( oSettings, mTr )
{
var anTds = [];
var anVisibleTds = [];

@ -1,9 +1,10 @@
/**
* Change the number of records that can be viewed on a single page in
* DataTables.
*
* @name fnLengthChange
* @anchor fnLengthChange
* @author <a href="http://www.webdetails.pt/">Pedro Alves</a>
* @summary
* @author [Pedro Alves](http://www.webdetails.pt/)
*
* @example
* $(document).ready(function() {
@ -12,7 +13,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnLengthChange = function ( oSettings, iDisplay )
jQuery.fn.dataTableExt.oApi.fnLengthChange = function ( oSettings, iDisplay )
{
oSettings._iDisplayLength = iDisplay;
oSettings.oApi._fnCalculateEnd( oSettings );

@ -4,9 +4,10 @@
* processing). Used in combination with the column sName parameter, simply
* pass in an object with the key/value pair being the column you wish to
* search on, and the value you wish to search for.
*
* @name fnMultiFilter
* @anchor fnMultiFilter
* @author <i>mrkevans</i>
* @summary
* @author _mrkevans_
*
* @example
* $(document).ready(function() {
@ -23,7 +24,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnMultiFilter = function( oSettings, oData ) {
jQuery.fn.dataTableExt.oApi.fnMultiFilter = function( oSettings, oData ) {
for ( var key in oData )
{
if ( oData.hasOwnProperty(key) )

@ -2,9 +2,10 @@
* Get information about the paging settings that DataTables is currently
* using to display each page, including the number of records shown, start
* and end points in the data set etc.
*
* @name fnPagingInfo
* @anchor fnPagingInfo
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -16,7 +17,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
jQuery.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
{
return {
"iStart": oSettings._iDisplayStart,

@ -3,8 +3,9 @@
* data loading from the server) it can be useful to make use of the
* 'processing' indicator built-into DataTables. This plug-in function
* exposes the internal DataTables function so it can be used for exactly this.
*
* @name fnProcessingIndicator
* @anchor fnProcessingIndicator
* @summary
* @author Allan Chappell
*
* @example

@ -3,9 +3,10 @@
* time, however it can be useful to re-read an Ajax source and have the table
* update. Typically you would need to use the fnClearTable() and fnAddData()
* functions, however this wraps it all up in a single function call.
*
* @name fnReloadAjax
* @anchor fnReloadAjax
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* // Example call to load a new file
@ -15,13 +16,13 @@
* oTable.fnReloadAjax();
*/
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
jQuery.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
{
// DataTables 1.10 compatibility - if 1.10 then `versionCheck` exists.
// 1.10's API has ajax reloading built in, so we use those abilities
// directly.
if ( $.fn.dataTable.versionCheck ) {
var api = new $.fn.dataTable.Api( oSettings );
if ( jQuery.fn.dataTable.versionCheck ) {
var api = new jQuery.fn.dataTable.Api( oSettings );
if ( sNewSource ) {
api.ajax.url( sNewSource ).load( fnCallback, !bStandingRedraw );

@ -2,8 +2,8 @@
* Enables filtration delay for keeping the browser more responsive while
* searching for a longer keyword.
* @name fnSetFilteringDelay
* @anchor fnSetFilteringDelay
* @author <a href="http://www.zygimantas.com/">Zygimantas Berziunas</a>, <a href="http://www.sprymedia.co.uk/">Allan Jardine</a> and <i>vex</i>
* @summary
* @author [Zygimantas Berziunas](http://www.zygimantas.com/), [Allan Jardine](http://www.sprymedia.co.uk/) and _vex_
*
* @example
* $(document).ready(function() {

@ -5,9 +5,10 @@
* initialisation, it can sometimes be useful to restore the original order
* after sorting has already occurred - which is exactly what this function
* does.
*
* @name fnSortNeutral
* @anchor fnSortNeutral
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -18,7 +19,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnSortNeutral = function ( oSettings )
jQuery.fn.dataTableExt.oApi.fnSortNeutral = function ( oSettings )
{
/* Remove any current sorting */
oSettings.aaSorting = [];

@ -1,8 +1,9 @@
/**
* Redraw the table (i.e. fnDraw) to take account of sorting and filtering,
* but retain the current pagination settings.
*
* @name fnStandingRedraw
* @anchor fnStandingRedraw
* @summary
* @author Jonathan Hoguet
*
* @example
@ -12,7 +13,7 @@
* } );
*/
$.fn.dataTableExt.oApi.fnStandingRedraw = function(oSettings) {
jQuery.fn.dataTableExt.oApi.fnStandingRedraw = function(oSettings) {
if(oSettings.oFeatures.bServerSide === false){
var before = oSettings._iDisplayStart;

@ -3,15 +3,16 @@
* fnSetColumnVis) it removes these elements from the DOM, effecting the index
* value for the column positions. This function converts the visible column
* index into a data column index (i.e. all columns regardless of visibility).
*
* @name fnVisibleToColumnIndex
* @anchor fnVisibleToColumnIndex
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
*
*/
$.fn.dataTableExt.oApi.fnVisibleToColumnIndex = function ( oSettings, iMatch )
jQuery.fn.dataTableExt.oApi.fnVisibleToColumnIndex = function ( oSettings, iMatch )
{
return oSettings.oApi._fnVisibleToColumnIndex( oSettings, iMatch );
};

@ -0,0 +1,20 @@
/**
* Jump to data
*
* @name page.JumpToData()
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @example
* table.page.jumpToData( 0, "Allan Jardine" );
*/
jQuery.fn.dataTable.Api.register( 'page.jumpToData()', function ( column, data ) {
var pos = this.column(column, {order:'current'}).data().indexOf( data );
if ( pos >= 0 ) {
var page = Math.floor( pos / this.page.info().length );
this.page( page ).draw( false );
}
} );

@ -1,8 +1,9 @@
/**
* Sum the values in a data set.
*
* @name sum()
* @anchor sum()
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary
* @author [Allan Jardine](http://sprymedia.co.uk)
* @requires DataTables 1.10+
*
* @example

@ -1,6 +1,11 @@
/**
* Used in combination with TableTools and selectable rows, this will allow you to switch between showing all rows and just the selected ones.
* @author <a href="http://stackoverflow.com/users/8507/phloopy">Caleb Harrelson</a>
* Used in combination with TableTools and selectable rows, this will allow you
* to switch between showing all rows and just the selected ones.
*
* @name Show selected only
* @summary Show only selected rows, or all rows, through filtering
* @requires TableTools
* @author [Caleb Harrelson](http://stackoverflow.com/users/8507/phloopy)
*
* @example
* $('#example').dataTable({

@ -2,17 +2,18 @@
* Filter a column on a specific date range. Note that you will likely need
* to change the id's on the inputs and the columns in which the start and
* end date exist.
* @name Range filtering (dates)
* @anchor range_dates
* @author <i>guillimon</i>
*
* @name Date range filter
* @summary Filter the table based on two dates in different columns
* @author _guillimon_
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable();
* var table = $('#example').DataTable();
*
* // Add event listeners to the two range filtering inputs
* $('#min').keyup( function() { oTable.fnDraw(); } );
* $('#max').keyup( function() { oTable.fnDraw(); } );
* $('#min').keyup( function() { table.draw(); } );
* $('#max').keyup( function() { table.draw(); } );
* } );
*/
@ -23,21 +24,21 @@ $.fn.dataTableExt.afnFiltering.push(
var iStartDateCol = 6;
var iEndDateCol = 7;
iFini=iFini.substring(6,10) + iFini.substring(3,5)+ iFini.substring(0,2)
iFfin=iFfin.substring(6,10) + iFfin.substring(3,5)+ iFfin.substring(0,2)
iFini=iFini.substring(6,10) + iFini.substring(3,5)+ iFini.substring(0,2);
iFfin=iFfin.substring(6,10) + iFfin.substring(3,5)+ iFfin.substring(0,2);
var datofini=aData[iStartDateCol].substring(6,10) + aData[iStartDateCol].substring(3,5)+ aData[iStartDateCol].substring(0,2);
var datoffin=aData[iEndDateCol].substring(6,10) + aData[iEndDateCol].substring(3,5)+ aData[iEndDateCol].substring(0,2);
if ( iFini == "" && iFfin == "" )
if ( iFini === "" && iFfin === "" )
{
return true;
}
else if ( iFini <= datofini && iFfin == "")
else if ( iFini <= datofini && iFfin === "")
{
return true;
}
else if ( iFfin >= datoffin && iFini == "")
else if ( iFfin >= datoffin && iFini === "")
{
return true;
}

@ -2,18 +2,19 @@
* Filter a specific numeric column on the value being between two given
* numbers. Note that you will likely need to change the id's on the inputs
* and the column in which the numeric value is given.
*
* @summary Filter the data between two numbers (inclusive)
* @name Range filtering (numbers)
* @anchor range_numbers
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
* // Initialise datatables
* var oTable = $('#example').dataTable();
* var table = $('#example').DataTable();
*
* // Add event listeners to the two range filtering inputs
* $('#min').keyup( function() { oTable.fnDraw(); } );
* $('#max').keyup( function() { oTable.fnDraw(); } );
* $('#min').keyup( function() { table.draw(); } );
* $('#max').keyup( function() { table.draw(); } );
* } );
*/
@ -24,15 +25,15 @@ jQuery.fn.dataTableExt.afnFiltering.push(
var iMax = document.getElementById('max').value * 1;
var iVersion = aData[iColumn] == "-" ? 0 : aData[iColumn]*1;
if ( iMin == "" && iMax == "" )
if ( iMin === "" && iMax === "" )
{
return true;
}
else if ( iMin == "" && iVersion < iMax )
else if ( iMin === "" && iVersion < iMax )
{
return true;
}
else if ( iMin < iVersion && "" == iMax )
else if ( iMin < iVersion && "" === iMax )
{
return true;
}

@ -0,0 +1,56 @@
/**
* When search a table with accented characters, it can be frustrating to have
* an input such as _Zurich_ not match _Zürich_ in the table (`u !== ü`). This
* type based search plug-in replaces the built-in string formatter in
* DataTables with a function that will remove replace the accented characters
* with their unaccented counterparts for fast and easy filtering.
*
* Note that with the accented characters being replaced, a search input using
* accented characters will no longer match. The second example below shows
* how the function can be used to remove accents from the search input as well,
* to mitigate this problem.
*
* @summary Replace accented characters with unaccented counterparts
* @name Accent neutralise
* @author Allan Jardine
*
* @example
* $(document).ready(function() {
* $('#example').dataTable();
* } );
*
* @example
* $(document).ready(function() {
* var table = $('#example').dataTable();
*
* // Remove accented character from search input as well
* $('#myInput').keyup( function () {
* table
* .search(
* jQuery.fn.DataTable.ext.type.search.string( this )
* )
* .draw()
* } );
* } );
*/
jQuery.fn.DataTable.ext.type.search.string = function ( data ) {
return ! data ?
'' :
typeof data === 'string' ?
data
.replace( /\n/g, ' ' )
.replace( /á/g, 'a' )
.replace( /é/g, 'e' )
.replace( /í/g, 'i' )
.replace( /ó/g, 'o' )
.replace( /ú/g, 'u' )
.replace( /ê/g, 'e' )
.replace( /î/g, 'i' )
.replace( /ô/g, 'o' )
.replace( /è/g, 'e' )
.replace( /ï/g, 'i' )
.replace( /ü/g, 'u' )
.replace( /ç/g, 'c' ) :
data;
};

@ -1,32 +1,38 @@
/**
* DataTables has a built in type called 'html' which will strip HTML tags
* DataTables has a built in type called `html` which will strip HTML tags
* from a search string, but it doesn't cope with nested HTML inside another
* element's attributes (for example DOM0 events with have HTML in them). This
* plug-in function overrules the built-in method and provides complete HTML
* tag removal. Note that this function is not included in DataTables by
* tag removal.
*
* Note that this function is not included in DataTables by
* default because it is slightly slower than the built-in method, which is
* good enough for by far the majority of use cases.
*
* @summary Strip HTML using DOM methods
* @name html
* @anchor html_column
* @author <i>guillimon</i>
* @author _guillimon_
*
* @example
* $(document).ready(function() {
* var oTable = $('#example').dataTable({
* "aoColumns": [
* "sType": "html",
* null
* $('#example').dataTable({
* "columnDefs": [
* { type: "html", target: 0 }
* ]
* });
* } );
*/
jQuery.fn.dataTableExt.ofnSearch['html'] = function ( sData ) {
var n = document.createElement('div');
n.innerHTML = sData;
if ( n.textContent ) {
return n.textContent.replace(/\n/g," ");
} else {
return n.innerText.replace(/\n/g," ");
}
(function () {
var _div = document.createElement('div');
jQuery.fn.dataTable.ext.type.search.html = function ( data ) {
_div.innerHTML = data;
return _div.textContent ?
_div.textContent.replace(/\n/g," ") :
_div.innerText.replace(/\n/g," ");
};
})();

@ -0,0 +1,31 @@
/**
* Telephone numbers are a common data point to display in HTML tables, and are
* often formatted (e.g. `dt-string 555-1234`). Typically, when searching a
* table a user would need to enter the number in exactly the same format it is
* displayed in, but this is not always convenient (e.g. you might search for
* `dt-string 5551`).
*
* This filtering plug-in will allow both forms to be matched be providing both
* the formatted and de-formatted data to the table's search.
*
* @summary Make phone numbers searchable formatted or unformatted
* @name Phone number
* @author Allan Jardine
*
* @example
* $(document).ready(function() {
* $('#example').dataTable( {
* columnDefs: [
* { type: 'phoneNumber', target: 4 }
* ]
* } );
* } );
*/
jQuery.fn.DataTable.ext.type.search.phoneNumber = function ( data ) {
return ! data ?
'' :
typeof data === 'string' ?
data + data.replace(/[ \-]/g, '') :
data;
};

@ -1,15 +1,23 @@
/*
* This plug-in adds another pagination option similar to full_numbers,
* except it adds ellipses around the page numbers when applicable.
* You can set how many page numbers should be displayed with the iShowPages option.
* This plug-in extends the oStdClasses object with the following properties:
* This plug-in adds another pagination option similar to `full_numbers`, except
* it adds ellipses around the page numbers when applicable. You can set how
* many page numbers should be displayed with the iShowPages option.
*
* This plug- in extends the oStdClasses object with the following properties:
* sPageEllipsis, sPageNumber and sPageNumbers.
*
* It also extends the oSettings object with the following properties:
* _iShowPages, _iShowPagesHalf, _iCurrentPage, _iTotalPages, _iFirstPage and _iLastPage.
* _iShowPages, _iShowPagesHalf, _iCurrentPage, _iTotalPages, _iFirstPage and
* _iLastPage.
*
* Note that DataTables 1.10 has this ability built in. As such, this plug-ins
* has been marked as depreciated, but may still be useful for if you are using
* an old version of DataTables.
*
* @name Ellipses
* @anchor ellipses
* @author <a href="http://daveden.wordpress.com/">Dave Kennedy</a>
* @summary Show ellipses in the pagination control where there is a gap in numbers
* @depreciated
* @author [Dave Kennedy](http://daveden.wordpress.com/)
* @example
* $(document).ready(function() {
* $('#example').dataTable({

@ -1,9 +1,10 @@
/**
* This pagination plug-in provides pagination controls for DataTables which
* match the style and interaction of the ExtJS library's grid component.
*
* @name ExtJS style
* @anchor extjs
* @author <a href="http://zachariahtimothy.wordpress.com/">Zach Curtis</a>
* @summary Pagination in the styling of ExtJS
* @author [Zach Curtis](http://zachariahtimothy.wordpress.com/)
*
* @example
* $(document).ready(function() {

@ -1,10 +1,17 @@
/**
* The built-in pagination functions provide either two buttons (forward / back)
* or lots of buttons (forward, back, first, last and individual pages). This
* plug-in meets the two in the middle providing navigation controls for forward, back, first and last.
* plug-in meets the two in the middle providing navigation controls for
* forward, back, first and last.
*
* DataTables has this ability built in using the `dt-string full` option of
* the `dt-init pagingType` initialisation option. As such, this plug-in is
* marked as depreciated.
*
* @name Four button navigation
* @anchor four_button
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Display forward, back, first and last buttons.
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -17,10 +24,10 @@
$.fn.dataTableExt.oPagination.four_button = {
"fnInit": function ( oSettings, nPaging, fnCallbackDraw )
{
nFirst = document.createElement( 'span' );
nPrevious = document.createElement( 'span' );
nNext = document.createElement( 'span' );
nLast = document.createElement( 'span' );
var nFirst = document.createElement( 'span' );
var nPrevious = document.createElement( 'span' );
var nNext = document.createElement( 'span' );
var nLast = document.createElement( 'span' );
nFirst.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sFirst ) );
nPrevious.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sPrevious ) );

@ -4,9 +4,10 @@
* text input box to accept new paging numbers (arrow keys are also allowed
* for), and four standard navigation buttons are also presented to the end
* user.
*
* @name Navigation with text input
* @anchor text_input
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Shows an input element into which the user can type a page number
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -82,7 +83,6 @@ $.fn.dataTableExt.oPagination.input = {
} );
$(nInput).keyup( function (e) {
if ( e.which == 38 || e.which == 39 )
{
this.value++;
@ -92,7 +92,7 @@ $.fn.dataTableExt.oPagination.input = {
this.value--;
}
if ( this.value == "" || this.value.match(/[^0-9]/) )
if ( this.value === "" || this.value.match(/[^0-9]/) )
{
/* Nothing entered or non-numeric character */
return;
@ -133,7 +133,7 @@ $.fn.dataTableExt.oPagination.input = {
{
var spans = an[i].getElementsByTagName('span');
var inputs = an[i].getElementsByTagName('input');
spans[3].innerHTML = " of "+iPages
spans[3].innerHTML = " of "+iPages;
inputs[0].value = iCurrentPage;
}
}

@ -3,9 +3,10 @@
* adds a little animation effect to the paging action by redrawing the table
* multiple times for each event, each draw progressing by one row until the
* required point in the table is reached.
*
* @name Scrolling navigation
* @anchor scrolling
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Show page changes as a redraw of the table, scrolling records.
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $(document).ready(function() {
@ -56,7 +57,7 @@ $.fn.dataTableExt.oPagination.scrolling = {
/* Correct for underrun */
if ( oSettings.iPagingEnd < 0 )
{
oSettings.iPagingEnd = 0;
oSettings.iPagingEnd = 0;
}
var iTween = $.fn.dataTableExt.oPagination.iTweenTime;

@ -1,9 +1,10 @@
/**
* This pagination plug-in provides a select menu with the list of the page
* This pagination plug-in provides a `dt-tag select` menu with the list of the page
* numbers that are available for viewing.
*
* @name Select list
* @anchor listbox
* @author <i>jneilliii</i>
* @summary Show a `dt-tag select` list of pages the user can pick from.
* @author _jneilliii_
*
* @example
* $(document).ready(function() {

@ -2,9 +2,17 @@
* Sort on the 'alt' tag of images in a column. This is particularly useful if
* you have a column of images (ticks and crosses for example) and you want to
* control the sorting using the alt tag.
*
* @name Alt string
* @anchor alt
* @author <i>Jumpy</i>
* @summary Use the `alt` attribute of an image tag as the data to sort upon.
* @author _Jumpy_
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'alt-string', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -3,9 +3,17 @@
* the word "the" at the start of some individual titles, which you don't want
* to include in your sorting order. This plug-in will strip the word "the"
* from the start of a string and sort on what is left.
*
* @name Anti-"the"
* @anchor anti_the
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort with the prefixed word `dt-string The` removed, if present
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'anti-the', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,17 +1,29 @@
/**
* Sorting in Javascript for Chinese Character. The Chinese Characters are sorted on the radical and number of
* strokes. This plug-in performs sorting for Chinese characters.
* <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/localeCompare">localeCompare MDC documentation</a>.
* Please also see <a href="http://www.datatables.net/forums/discussion/9700/sorting-non-ascii-characters-and-data-content-html-tag-sorting/p1">note about localeCompare and IE9</a>.
* Sorting in Javascript for Chinese Character. The Chinese Characters are
* sorted on the radical and number of strokes. This plug-in performs sorting
* for Chinese characters using the Javascript [localeCompare](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/localeCompare)
* function.
*
* Please note that `localeCompare` is not implemented in the same way in all
* browsers, potentially leading to different results (particularly in IE).
*
* @name Chinese (string)
* @anchor chinese-string
* @author <a href="http://www.lcube.se/sorting-chinese-characters-in-javascript/">Patrik Lindstr<EFBFBD>m</a>
* @summary Sort Chinese characters
* @author [Patrik Lindström](http://www.lcube.se/sorting-chinese-characters-in-javascript/)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'chinese-string', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"chinese-string-asc" : function (s1, s2) {
return s1.localeCompare(s2);
},
"chinese-string-desc" : function (s1, s2) {
return s2.localeCompare(s1);
}

@ -2,9 +2,22 @@
* This plug-in will provide numeric sorting for currency columns (either
* detected automatically with the currency type detection plug-in or set
* manually) while taking account of the currency symbol ($ or £ by default).
*
* DataTables 1.10+ has currency sorting abilities built-in and will be
* automatically detected. As such this plug-in is marked as depreciated, but
* might be useful when working with old versions of DataTables.
*
* @name Currency
* @anchor currency
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort data numerically when it has a leading currency symbol.
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'currency', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,15 +1,15 @@
/**
* Read information from a column of checkboxes (input elements with type
* checkbox) and return an array to use as a basis for sorting.
*
* @summary Sort based on the checked state of checkboxes in a column
* @name Checkbox data source
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @author [Allan Jardine](http://sprymedia.co.uk)
*/
$.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, iColumn )
$.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col )
{
var aData = [];
$( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( this.checked==true ? "1" : "0" );
return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
return $('input', td).prop('checked') ? '1' : '0';
} );
return aData;
};

@ -1,15 +1,16 @@
/**
* Read information from a column of select (drop down) menus and return an
* array to use as a basis for sorting.
*
* @summary Sort based on the value of the `dt-tag select` options in a column
* @name Select menu data source
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @requires DataTables 1.10+
* @author [Allan Jardine](http://sprymedia.co.uk)
*/
$.fn.dataTableExt.afnSortData['dom-select'] = function ( oSettings, iColumn )
$.fn.dataTable.ext.order['dom-select'] = function ( settings, col )
{
var aData = [];
$( 'td:eq('+iColumn+') select', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( $(this).val() );
return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
return $('select', td).val();
} );
return aData;
};

@ -1,15 +1,16 @@
/**
* Read information from a column of input (type text) elements and return an
* array to use as a basis for sorting.
*
* @summary Sorting based on the values of `dt-tag input` elements in a column.
* @name Input element data source
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @requires DataTables 1.10+
* @author [Allan Jardine](http://sprymedia.co.uk)
*/
$.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn )
$.fn.dataTable.ext.order['dom-text'] = function ( settings, col )
{
var aData = [];
$( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {
aData.push( this.value );
return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
return $('input', td).val();
} );
return aData;
};

@ -1,18 +1,26 @@
/*
* Adds a new sorting option to dataTables called <code>date-dd-mmm-yyyy</code>. Also
* Adds a new sorting option to dataTables called `date-dd-mmm-yyyy`. Also
* includes a type detection plug-in. Matches and sorts date strings in
* the format: <code>(dd/mmm/yyyy</code>. For example:
* <ul>
* <li>02-FEB-1978</li>
* <li>17-MAY-2013</li>
* <li>31-JAN-2014</li>
* </ul>
* the format: `dd/mmm/yyyy`. For example:
*
* @name Date dd-mmm-yyyy
* @anchor date-dd-mmm-yyyy
* @author <a href="http://www.appliedinter.net/jeromy_works/">Jeromy French</a>
* * 02-FEB-1978
* * 17-MAY-2013
* * 31-JAN-2014
*
* @name Date (dd-mmm-yyyy)
* @summary Sort dates in the format `dd-mmm-yyyy`
* @author [Jeromy French](http://www.appliedinter.net/jeromy_works/)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'date-dd-mmm-yyyy', targets: 0 }
* ]
* } );
*/
(function () {
var customDateDDMMMYYYYToOrd = function (date) {
"use strict"; //let's avoid tom-foolery in this function
// Convert to a number YYYYMMDD which we can use to order
@ -20,7 +28,8 @@ var customDateDDMMMYYYYToOrd = function (date) {
return (dateParts[2] * 10000) + ($.inArray(dateParts[1].toUpperCase(), ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]) * 100) + dateParts[0];
};
// This will help DataTables magic detect the "dd-MMM-yyyy" format; Unshift so that it's the first data type (so it takes priority over existing)
// This will help DataTables magic detect the "dd-MMM-yyyy" format; Unshift
// so that it's the first data type (so it takes priority over existing)
jQuery.fn.dataTableExt.aTypes.unshift(
function (sData) {
"use strict"; //let's avoid tom-foolery in this function
@ -45,3 +54,5 @@ jQuery.fn.dataTableExt.oSort['date-dd-mmm-yyyy-desc'] = function (a, b) {
ordB = customDateDDMMMYYYYToOrd(b);
return (ordA < ordB) ? 1 : ((ordA > ordB) ? -1 : 0);
};
})();

@ -0,0 +1,64 @@
/**
* This sorting plug-in for DataTables will correctly sort data in date time
* format typically used in Germany - `dd.mm.YYYY HH:mm`.
*
* @name Date / time (dd.mm.YYYY HH:mm)
* @summary Sort date / time in the format `dd.mm.YYYY HH:mm`.
* @author [Ronny Vedrilla](http://www.ambient-innovation.com)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'de_datetime', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"de_datetime-asc": function ( a, b ) {
var x, y;
if ($.trim(a) !== '') {
var deDatea = $.trim(a).split(' ');
var deTimea = deDatea[1].split(':');
var deDatea2 = deDatea[0].split('.');
x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1]) * 1;
} else {
x = Infinity; // = l'an 1000 ...
}
if ($.trim(b) !== '') {
var deDateb = $.trim(b).split(' ');
var deTimeb = deDateb[1].split(':');
deDateb = deDateb[0].split('.');
y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1]) * 1;
} else {
y = Infinity;
}
var z = ((x < y) ? -1 : ((x > y) ? 1 : 0));
return z;
},
"de_datetime-desc": function ( a, b ) {
var x, y;
if ($.trim(a) !== '') {
var deDatea = $.trim(a).split(' ');
var deTimea = deDatea[1].split(':');
var deDatea2 = deDatea[0].split('.');
x = (deDatea2[2] + deDatea2[1] + deDatea2[0] + deTimea[0] + deTimea[1]) * 1;
} else {
x = Infinity;
}
if ($.trim(b) !== '') {
var deDateb = $.trim(b).split(' ');
var deTimeb = deDateb[1].split(':');
deDateb = deDateb[0].split('.');
y = (deDateb[2] + deDateb[1] + deDateb[0] + deTimeb[0] + deTimeb[1]) * 1;
} else {
y = Infinity;
}
var z = ((x < y) ? 1 : ((x > y) ? -1 : 0));
return z;
}
} );

@ -2,28 +2,37 @@
* Similar to the Date (dd/mm/YY) data sorting plug-in, this plug-in offers
* additional flexibility with support for spaces between the values and
* either . or / notation for the separators.
*
* @name Date (dd . mm[ . YYYY])
* @anchor date_eu
* @author <a href="http://galjot.si/">Robert Sedovšek</a>
* @summary Sort dates in the format `dd/mm/YY[YY]` (with optional spaces)
* @author [Robert Sedovšek](http://galjot.si/)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'date-eu', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"date-eu-pre": function ( date ) {
var date = date.replace(" ", "");
date = date.replace(" ", "");
var eu_date, year;
if (date.indexOf('.') > 0) {
/*date a, format dd.mn.(yyyy) ; (year is optional)*/
var eu_date = date.split('.');
eu_date = date.split('.');
} else {
/*date a, format dd/mn/(yyyy) ; (year is optional)*/
var eu_date = date.split('/');
eu_date = date.split('/');
}
/*year (optional)*/
if (eu_date[2]) {
var year = eu_date[2];
year = eu_date[2];
} else {
var year = 0;
year = 0;
}
/*month*/

@ -3,20 +3,31 @@
* formatting, which is common in France and other European countries. It can
* also be quickly adapted for other formatting as required. Furthermore, this
* date sorting plug-in allows for empty values in the column.
*
* @name Date (dd/mm/YYY hh:ii:ss)
* @anchor date_euro
* @author <a href="http://coolforest.net/">Ronan Guilloux</a>
* @summary Sort date / time in the format `dd/mm/YYY hh:ii:ss`
* @author [Ronan Guilloux](http://coolforest.net/)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'date-euro', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"date-euro-pre": function ( a ) {
if ($.trim(a) != '') {
var x;
if ( $.trim(a) !== '' ) {
var frDatea = $.trim(a).split(' ');
var frTimea = frDatea[1].split(':');
var frDatea2 = frDatea[0].split('/');
var x = (frDatea2[2] + frDatea2[1] + frDatea2[0] + frTimea[0] + frTimea[1] + frTimea[2]) * 1;
} else {
var x = 10000000000000; // = l'an 1000 ...
x = (frDatea2[2] + frDatea2[1] + frDatea2[0] + frTimea[0] + frTimea[1] + frTimea[2]) * 1;
}
else {
x = Infinity;
}
return x;

@ -1,13 +1,21 @@
/**
* DataTables internal date sorting replies on Date.parse() which is part of
* DataTables internal date sorting replies on `Date.parse()` which is part of
* the Javascript language, but you may wish to sort on dates which is doesn't
* recognise. The following is a plug-in for sorting dates in the format
* dd/mm/yy.
* `dd/mm/yy`.
*
* An automatic type detection plug-in is available for this sorting plug-in.
*
* @name Date (dd/mm/YY)
* @anchor date_uk
* @summary Sort dates in the format `dd/mm/YY`
* @author Andy McMaster
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'date-uk', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,59 +1,81 @@
/*
* Adds a new sorting option to dataTables called <code>datetime-us</code>. Also
* includes a type detection plug-in. Matches and sorts date / time strings in
* the format: <code>(m)m/(d)d/(yy)yy (h)h/m(m) (am|pm)</code>. For example:
* <ul>
* <li>1/1/13 1:4 pm</li>
* <li>01/01/2013 01:04 PM</li>
* <li>1/1/2013 1:04 Pm</li>
* </ul>
* Adds a new sorting option to dataTables called `datetime-us`.
*
* Also included is a type detection plug-in. Matches and sorts date / time
* strings in the format: `(m)m/(d)d/(yy)yy (h)h/m(m) (am|pm)`. For example:
*
* * 1/1/13 1:4 pm
* * 01/01/2013 01:04 PM
* * 1/1/2013 1:04 Pm
*
* @name Date / time - US
* @anchor datetime_us
* @author <a href="http://mrkmg.com/">Kevin Gravier</a>
* @summary Sort date / time in the format `m/d/yy h:m am|pm`
* @author [Kevin Gravier](http://mrkmg.com/)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'datetime-us', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"datetime-us-pre": function ( a ) {
var b = a.match(/(\d{1,2})\/(\d{1,2})\/(\d{2,4}) (\d{1,2}):(\d{1,2}) (am|pm|AM|PM|Am|Pm)/),
month = b[1],
day = b[2],
year = b[3],
hour = b[4],
min = b[5],
ap = b[6];
jQuery.extend(jQuery.fn.dataTableExt.oSort, {
"datetime-us-pre": function (a) {
var b = a.match(/(\d{1,2})\/(\d{1,2})\/(\d{2,4}) (\d{1,2}):(\d{1,2}) (am|pm|AM|PM|Am|Pm)/),
month = b[1],
day = b[2],
year = b[3],
hour = b[4],
min = b[5],
ap = b[6];
if (hour == '12') {
hour = '0';
if (ap == 'pm') {
hour = parseInt(hour, 10) + 12;
}
if(hour == '12') hour = '0';
if(ap == 'pm') hour = parseInt(hour, 10)+12;
if (year.length == 2) {
if (parseInt(year, 10) < 70) {
year = '20' + year;
}
else {
year = '19' + year;
}
}
if (month.length == 1) {
month = '0' + month;
}
if (day.length == 1) {
day = '0' + day;
}
if (hour.length == 1) {
hour = '0' + hour;
}
if (min.length == 1) {
min = '0' + min;
}
if(year.length == 2){
if(parseInt(year, 10)<70) year = '20'+year;
else year = '19'+year;
}
if(month.length == 1) month = '0'+month;
if(day.length == 1) day = '0'+day;
if(hour.length == 1) hour = '0'+hour;
if(min.length == 1) min = '0'+min;
var tt = year + month + day + hour + min;
return tt;
}
},
var tt = year+month+day+hour+min;
return tt;
},
"datetime-us-asc": function ( a, b ) {
return a - b;
},
"datetime-us-asc": function (a, b) {
return a - b;
},
"datetime-us-desc": function ( a, b ) {
return b - a;
}
"datetime-us-desc": function (a, b) {
return b - a;
}
});
jQuery.fn.dataTableExt.aTypes.unshift(
function ( sData )
{
if (sData !== null && sData.match(/\d{1,2}\/\d{1,2}\/\d{2,4} \d{1,2}:\d{1,2} (am|pm|AM|PM|Am|Pm)/))
{
function (sData) {
if (sData !== null && sData.match(/\d{1,2}\/\d{1,2}\/\d{2,4} \d{1,2}:\d{1,2} (am|pm|AM|PM|Am|Pm)/)) {
return 'datetime-us';
}
return null;
}
return 'datetime-us';
}
return null;
}
);

@ -1,11 +1,19 @@
/**
* Sort by priority through an enumerated list. In this case the words 'High',
* 'Medium' and 'Low' are used and thus sorted in priority order. This works
* Sort by priority through an enumerated list. In this case the words _High_,
* _Medium_ and _Low_ are used and thus sorted in priority order. This works
* by converting the works to a numerical value and then sorting based on that
* value.
*
* @name enum
* @anchor enum
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort an enumerated list of options
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'enum', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -4,9 +4,17 @@
* magnitude of the file size. This plug-in allows sorting to take these
* indicates of size into account. A counterpart type detection plug-in
* is also available.
*
* @name File size
* @anchor file_size
* @author <i>anjibman</i>
* @summary Sort abbreviated file sizes correctly (8MB, 4KB etc)
* @author _anjibman_
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'file-size', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,10 +1,23 @@
/**
* This plug-in will provide numeric sorting for numeric columns which have extra
* formatting, such as thousands seperators, currency symobols or any other
* This plug-in will provide numeric sorting for numeric columns which have
* extra formatting, such as thousands separators, currency symbols or any other
* non-numeric data.
*
* DataTables 1.10+ has formatted number detection and sorting abilities built-
* in. As such this plug-in is marked as depreciated, but might be useful when
* working with old versions of DataTables.
*
* @name Formatted numbers
* @anchor formatted_numbers
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort numbers which are displayed with thousand separators
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'formatted-num', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -3,9 +3,17 @@
* be most useful when using DataTables for a networking application, and
* reporting information containing IP address. Also has a matching type
* detection plug-in for automatic type detection.
*
* @name IP addresses
* @anchor ip_address
* @summary Sort IP addresses numerically
* @author Brad Wasson
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'ip-address', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,9 +1,17 @@
/**
* This sorting plug-in will sort, in calendar order, data which
* is in the format "MM YY".
* @name Month / year sorting
* @anchor monthYear
*
* @name Date (MM YY)
* @anchor Sort dates in the format `MM YY`
* @author Michael Motek
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'monthYear', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,13 +1,22 @@
/**
* Data can often be a complicated mix of numbers and letters (file names
* are a common example) and sorting them in a natural manner is quite a
* difficult problem. Fortunately a deal of work has already been done in
* this area by other authors - the following plug-in uses the naturalSort()
* function by Jim Palmer (<a href="http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm-with-unicode-support/">download it here</a>)
* to provide natural sorting in DataTables.
* difficult problem.
*
* Fortunately a deal of work has already been done in this area by other
* authors - the following plug-in uses the [naturalSort() function by Jim
* Palmer](http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm-with-unicode-support) to provide natural sorting in DataTables.
*
* @name Natural sorting
* @anchor natrual
* @author <a href="http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm/">Jim Palmer</a>
* @summary Sort data with a mix of numbers and letters _naturally_.
* @author [Jim Palmer](http://www.overset.com/2008/09/01/javascript-natural-sort-algorithm-with-unicode-support)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'natural', targets: 0 }
* ]
* } );
*/
(function() {
@ -31,26 +40,39 @@ function naturalSort (a, b) {
xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'),
// numeric, hex or date detection
xD = parseInt(x.match(hre)) || (xN.length != 1 && x.match(dre) && Date.parse(x)),
yD = parseInt(y.match(hre)) || xD && y.match(dre) && Date.parse(y) || null;
xD = parseInt(x.match(hre), 10) || (xN.length != 1 && x.match(dre) && Date.parse(x)),
yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null;
// first try and sort Hex codes or Dates
if (yD)
if ( xD < yD ) return -1;
else if ( xD > yD ) return 1;
if (yD) {
if ( xD < yD ) {
return -1;
}
else if ( xD > yD ) {
return 1;
}
}
// natural sorting through split numeric strings and default strings
for(var cLoc=0, numS=Math.max(xN.length, yN.length); cLoc < numS; cLoc++) {
// find floats not starting with '0', string or 0 if not defined (Clint Priest)
var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc]) || xN[cLoc] || 0;
var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc]) || yN[cLoc] || 0;
var oFxNcL = !(xN[cLoc] || '').match(ore) && parseFloat(xN[cLoc], 10) || xN[cLoc] || 0;
var oFyNcL = !(yN[cLoc] || '').match(ore) && parseFloat(yN[cLoc], 10) || yN[cLoc] || 0;
// handle numeric vs string comparison - number < string - (Kyle Adams)
if (isNaN(oFxNcL) !== isNaN(oFyNcL)) return (isNaN(oFxNcL)) ? 1 : -1;
if (isNaN(oFxNcL) !== isNaN(oFyNcL)) {
return (isNaN(oFxNcL)) ? 1 : -1;
}
// rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
else if (typeof oFxNcL !== typeof oFyNcL) {
oFxNcL += '';
oFyNcL += '';
}
if (oFxNcL < oFyNcL) return -1;
if (oFxNcL > oFyNcL) return 1;
if (oFxNcL < oFyNcL) {
return -1;
}
if (oFxNcL > oFyNcL) {
return 1;
}
}
return 0;
}

@ -4,9 +4,22 @@
* strips the HTML and then sorts by numbers. Note also that this sorting
* plug-in has an equivalent type detection plug-in which can make integration
* easier.
*
* DataTables 1.10+ has HTML numeric data type detection and sorting abilities
* built-in. As such this plug-in is marked as depreciated, but might be useful
* when working with old versions of DataTables.
*
* @name Numbers with HTML
* @anchor numbers_html
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort data which is a mix of HTML and numeric data.
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'num-html', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,15 +1,24 @@
/**
* It is not uncommon for non-English speaking countries to use a comma for a
* decimal place. This sorting plug-in shows how that can be taken account of in
* sorting by adding the type 'numeric-comma' to DataTables. A type detection
* sorting by adding the type `numeric-comma` to DataTables. A type detection
* plug-in for this sorting method is provided below.
*
* Please note that the 'Formatted numbers' type detection and sorting plug-ins
* offer greater flexibility that this plug-in and should be used in preference
* to this method.
*
* @name Commas for decimal place
* @anchor numeric_comma
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort numbers correctly which use a common as the decimal place.
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'numeric-comma', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,8 +1,21 @@
/**
* Sort numeric data which has a percent sign with it.
*
* DataTables 1.10+ has percentage data type detection and sorting abilities
* built-in. As such this plug-in is marked as depreciated, but might be useful
* when working with old versions of DataTables.
*
* @name Percentage
* @anchor percentage
* @author <a href="http://jonathanromley.org/">Jonathan Romley</a>
* @summary Sort numeric data with a postfixed percentage symbol
* @depreciated
* @author [Jonathan Romley](http://jonathanromley.org/)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'percent', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -2,9 +2,17 @@
* Sorting in Javascript can be difficult to get right with non-Roman
* characters - for which special consideration must be made. This plug-in
* performs correct sorting on Persian characters.
*
* @name Persian
* @anchor Persian
* @author <a href="http://www.afshinblog.com/">Afshin Mehrabani</a>
* @summary Sort Persian strings alphabetically
* @author [Afshin Mehrabani](http://www.afshinblog.com/)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'pstring', targets: 0 }
* ]
* } );
*/
(function(){
@ -14,23 +22,25 @@ var persianSort = [ 'آ', 'ا', 'ب', 'پ', 'ت', 'ث', 'ج', 'چ', 'ح', 'خ',
function GetUniCode(source) {
source = $.trim(source);
result = '';
var result = '';
var i, index;
for (i = 0; i < source.length; i++) {
//Check and fix IE indexOf bug
if (!Array.indexOf) {
var index = jQuery.inArray(source.charAt(i), persianSort);
index = jQuery.inArray(source.charAt(i), persianSort);
}else{
var index = persianSort.indexOf(source.charAt(i));
index = persianSort.indexOf(source.charAt(i));
}
if (index < 0) {
index = source.charCodeAt(i);
}
if (index < 10)
if (index < 10) {
index = '0' + index;
}
result += '00' + index;
}
return 'a' + result;
};
}
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
"pstring-pre": function ( a ) {

@ -1,9 +1,17 @@
/**
* This plug-in will treat numbers which are in scientific notation (for
* example 1E-10, 1.2E6 etc) and sort them numerically.
* example `1E-10`, `1.2E6` etc) and sort them numerically.
*
* @name Scientific notation sorting
* @anchor scientific
* @author <a href="http://datatables.net/forums/profile/21757/nickschurch">Nick Schurch</a>
* @summary Sort data which is written in exponential notation.
* @author [Nick Schurch](http://datatables.net/forums/profile/21757/nickschurch)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'scientific', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -2,9 +2,17 @@
* Although DataTables' internal numeric sorting works no problem on negative
* numbers, it does not accept positively signed numbers. This plug-in will
* sort just such data numerically.
*
* @name Fully signed numbers sorting
* @anchor Signed_Numbers
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort data numerically with a leading `+` symbol (as well as `-`).
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'signed-num', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,14 +1,27 @@
/**
* An alternative to the formatted number sorting function above (particularly
* useful when considering localisation which uses dots/periods for 10^3
* useful when considering localisation which uses dots / periods for 10^3
* separation rather than decimal places). Another method of overcoming it
* difficulties of sorting formatted numbers is to have the data to be sorted
* upon separate from the visual data. This sorting function pair will use the
* 'title' attribute of en empty span element (or anything else) to sort
* numerically (for example <span title="1000000"><span>1'000'000).
* numerically (for example `<span title="1000000"><span>1'000'000`).
*
* Note that the HTML5 `data-sort` attribute can be [used to supply sorting data
* to DataTables](//datatables.net/manual/orthogonal-data) and is preferable to
* using this method, which is therefore marked as depreciated.
*
* @name Hidden title numeric sorting
* @anchor hidden_title
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort data numerically based on an attribute on an empty element.
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'title-numeric', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,11 +1,23 @@
/**
* Just like the "hidden title numeric sorting" plug-in, this sorting plug-in
* Just like the _hidden title numeric sorting_ plug-in, this sorting plug-in
* will take the information to be sorted on from the title attribute of a span
* element. The only difference is that it is string based sorting rather than
* numeric.
*
* Note that the HTML5 `data-sort` attribute can be [used to supply sorting data
* to DataTables](//datatables.net/manual/orthogonal-data) and is preferable to
* using this method, which is therefore marked as depreciated.
*
* @name Hidden title string sorting
* @anchor hidden_title_string
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Sort data as a string based on an attribute on an empty element.
* @author [Allan Jardine](http://sprymedia.co.uk)
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'title-string', targets: 0 }
* ]
* } );
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {

@ -1,11 +1,17 @@
/**
* This plug-in will add automatic detection for currency columns to
* DataTables. Note that only $ and £ symbols are detected with this code,
* DataTables. Note that only $, £ and symbols are detected with this code,
* but it is trivial to add more or change the current ones. This is best used
* in conjunction with the currency sorting plug-in.
*
* DataTables 1.10+ has currency sorting abilities built-in and will be
* automatically detected. As such this plug-in is marked as depreciated, but
* might be useful when working with old versions of DataTables.
*
* @name Currency
* @anchor currency
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>, Nuno Gomes
* @summary Detect data of numeric type with a leading currency symbol.
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk), Nuno Gomes
*/
(function(){

@ -1,8 +1,9 @@
/**
* Automatically detect British (dd/mm/yyyy) date types. Goes with the UK
* Automatically detect British (`dd/mm/yyyy`) date types. Goes with the UK
* date sorting plug-in.
* @name UK date type detection
* @anchor uk_date
*
* @name Date (`dd/mm/yyyy`)
* @summary Detect data which is in the date format `dd/mm/yyyy`
* @author Andy McMaster
*/

@ -2,9 +2,10 @@
* Detect "file size" type columns automatically. Commonly used for computer
* file sizes, this can allow sorting to take the order of magnitude indicated
* by the label (GB etc) into account.
*
* @name File size
* @anchor file_size
* @author <i>anjibman</i>
* @summary Detect abbreviated file size data (8MB, 4KB etc)
* @author _anjibman_
*/
jQuery.fn.dataTableExt.aTypes.unshift(
@ -14,7 +15,7 @@ jQuery.fn.dataTableExt.aTypes.unshift(
var Char;
/* Check the numeric part */
for ( i=0 ; i<(sData.length - 3) ; i++ )
for ( var i=0 ; i<(sData.length - 3) ; i++ )
{
Char = sData.charAt(i);
if (sValidChars.indexOf(Char) == -1)

@ -3,11 +3,16 @@
* formatted number (for example 1,000,000) can be detected automatically and
* sorted numerically. Note that characters a-z are not automatically removed,
* otherwise there is a risk of detecting columns as numeric which should not
* be. Also note that the jQuery 1.7 method isNumeric is used, so jQuery 1.7
* is required.
* be.
*
* DataTables 1.10+ has formatted number type detection and sorting abilities
* built-in. As such this plug-in is marked as depreciated, but might be useful
* when working with old versions of DataTables.
*
* @name Formatted numbers
* @anchor formatted_numbers
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary formatted_numbers
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*/
jQuery.fn.dataTableExt.aTypes.unshift(

@ -1,8 +1,9 @@
/**
* Automatically detect IP addresses in dot notation. Goes perfectly with the
* IP address sorting function.
*
* @name IP address detection
* @anchor ip_address
* @summary Detect data which is in IP address notation
* @author Brad Wasson
*/

@ -3,9 +3,15 @@
* strip the HTML tags and then check to see if the remaining data is numeric.
* If it is, then the data can be sorted numerically with the Numbers with HTML
* sorting plug-in.
*
* DataTables 1.10+ has numeric HTML data type and sorting abilities built-in.
* As such this plug-in is marked as depreciated, but might be useful when
* working with old versions of DataTables.
*
* @name Numbers with HTML
* @anchor numbers_html
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Detect data which is a mix of HTML and numeric data.
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*/
jQuery.fn.dataTableExt.aTypes.unshift( function ( sData )

@ -5,9 +5,11 @@
* Please note that the 'Formatted numbers' type detection and sorting plug-ins
* offer greater flexibility that this plug-in and should be used in preference
* to this method.
*
* @name Commas for decimal place
* @anchor numeric_comma
* @author <a href="http://sprymedia.co.uk">Allan Jardine</a>
* @summary Detect numeric data which uses a comma as the decimal place.
* @depreciated
* @author [Allan Jardine](http://sprymedia.co.uk)
*/
jQuery.fn.dataTableExt.aTypes.unshift(
@ -24,7 +26,7 @@ jQuery.fn.dataTableExt.aTypes.unshift(
}
/* Check the numeric part */
for ( i=iStart ; i<sData.length ; i++ )
for ( var i=iStart ; i<sData.length ; i++ )
{
Char = sData.charAt(i);
if (sValidChars.indexOf(Char) == -1)

Loading…
Cancel
Save