dom-checkbox.js 523 B

123456789101112131415
  1. /**
  2. * Read information from a column of checkboxes (input elements with type
  3. * checkbox) and return an array to use as a basis for sorting.
  4. *
  5. * @summary Sort based on the checked state of checkboxes in a column
  6. * @name Checkbox data source
  7. * @author [Allan Jardine](http://sprymedia.co.uk)
  8. */
  9. $.fn.dataTable.ext.order['dom-checkbox'] = function ( settings, col )
  10. {
  11. return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
  12. return $('input', td).prop('checked') ? '1' : '0';
  13. } );
  14. };