File: demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/api/fnSortNeutral.js

Recommend this page to a friend!
  Classes of Emmanuel Podvin   Blapy   demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/api/fnSortNeutral.js   Download  
File: demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/api/fnSortNeutral.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Blapy
jQuery plugin to load linked pages using AJAX
Author: By
Last change: Update of demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/api/fnSortNeutral.js
Date: 3 years ago
Size: 1,132 bytes
 

Contents

Class file image Download
/** * This function will restore the order in which data was read into a DataTable * (for example from an HTML source). Although you can set aaSorting to be an * empty array (`[ ]`) in order to prevent sorting during 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 * @summary Change ordering of the table to its data load order * @author [Allan Jardine](http://sprymedia.co.uk) * * @example * $(document).ready(function() { * var table = $('#example').dataTable(); * * // Sort in the order that was originally in the HTML * table.fnSortNeutral(); * } ); */ jQuery.fn.dataTableExt.oApi.fnSortNeutral = function ( oSettings ) { /* Remove any current sorting */ oSettings.aaSorting = []; /* Sort display arrays so we get them in numerical order */ oSettings.aiDisplay.sort( function (x,y) { return x-y; } ); oSettings.aiDisplayMaster.sort( function (x,y) { return x-y; } ); /* Redraw */ oSettings.oApi._fnReDraw( oSettings ); };