You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/sorting/title-string.js

78 lines
2.0 KiB
JavaScript

/*! © SpryMedia Ltd - datatables.net/license */
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
// AMD
define( ['jquery', 'datatables.net'], function ( $ ) {
return factory( $, window, document );
} );
}
else if ( typeof exports === 'object' ) {
// CommonJS
var jq = require('jquery');
var cjsRequires = function (root, $) {
if ( ! $.fn.dataTable ) {
require('datatables.net')(root, $);
}
};
if (typeof window === 'undefined') {
module.exports = function (root, $) {
if ( ! root ) {
// CommonJS environments without a window global must pass a
// root. This will give an error otherwise
root = window;
}
if ( ! $ ) {
$ = jq( root );
}
cjsRequires( root, $ );
return factory( $, root, root.document );
};
}
else {
cjsRequires( window, jq );
module.exports = factory( jq, window, window.document );
}
}
else {
// Browser
factory( jQuery, window, document );
}
}(function( $, window, document, undefined ) {
'use strict';
var DataTable = $.fn.dataTable;
/**
* 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
11 years ago
* using this method, which is therefore marked as deprecated.
*
* @name Hidden title string sorting
* @summary Sort data as a string based on an attribute on an empty element.
* @author [Allan Jardine](http://sprymedia.co.uk)
11 years ago
* @deprecated
*
* @example
* $('#example').dataTable( {
* columnDefs: [
* { type: 'title-string', targets: 0 }
* ]
* } );
*/
DataTable.ext.type.order['title-string-pre'] = function (a) {
return a.match(/title="(.*?)"/)[1].toLowerCase();
};
return DataTable;
}));