Merge pull request #481 from blackdrago/feature/custom-data-source
Adding type dom-text-numeric typepull/482/head
commit
5fa8153fdf
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Read information from a column of input (type number) 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
|
||||||
|
* @requires DataTables 1.10+
|
||||||
|
* @author [Allan Jardine](http://sprymedia.co.uk)
|
||||||
|
*/
|
||||||
|
|
||||||
|
$.fn.dataTable.ext.order['dom-text-numeric'] = function ( settings, col )
|
||||||
|
{
|
||||||
|
return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
|
||||||
|
return $('input', td).val() * 1;
|
||||||
|
} );
|
||||||
|
}
|
Loading…
Reference in new issue