PHP Classes

File: source/asset/crules/datatables-plugins/sorting/ip-address.js

Recommend this page to a friend!
  Classes of ask sa sa   Rimau waf   source/asset/crules/datatables-plugins/sorting/ip-address.js   Download  
File: source/asset/crules/datatables-plugins/sorting/ip-address.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Rimau waf
Application to configure Web server module options
Author: By
Last change:
Date: 1 year ago
Size: 1,032 bytes
 

Contents

Class file image Download
/** * Sorts a column containing IP addresses in typical dot notation. This can * 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 * @summary Sort IP addresses numerically * @author Brad Wasson * * @example * $('#example').dataTable( { * columnDefs: [ * { type: 'ip-address', targets: 0 } * ] * } ); */ jQuery.extend( jQuery.fn.dataTableExt.oSort, { "ip-address-pre": function ( a ) { var m = a.split("."), x = ""; for(var i = 0; i < m.length; i++) { var item = m[i]; if(item.length == 1) { x += "00" + item; } else if(item.length == 2) { x += "0" + item; } else { x += item; } } return x; }, "ip-address-asc": function ( a, b ) { return ((a < b) ? -1 : ((a > b) ? 1 : 0)); }, "ip-address-desc": function ( a, b ) { return ((a < b) ? 1 : ((a > b) ? -1 : 0)); } } );