diff --git a/sorting/custom-data-source/dom-select.js b/sorting/custom-data-source/dom-select.js index 22774e3..d4be390 100644 --- a/sorting/custom-data-source/dom-select.js +++ b/sorting/custom-data-source/dom-select.js @@ -14,3 +14,15 @@ $.fn.dataTable.ext.order['dom-select'] = function ( settings, col ) return $('select', td).val(); } ); }; + +/** + * @summary Sort based on the selected text of the `dt-tag select` options in a column + * @author [Somasekar N](somasekar.cse@gmail.com) + */ + +$.fn.dataTable.ext.order['dom-select'] = function ( settings, col ) +{ + return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) { + return $('select :selected', td).val(); + } ); +};