Datatable sorting with input cells values and empty values

Datatable sorting with input cells values and empty values

avvarusavvarus Posts: 1Questions: 1Answers: 0

Hello ,

My scenario is as below

EMPTY_CELL
123
345
EMPTY_CELL
EMPTY_CELL
567
EMPTY_CELL

upon ascending it should sort by

123
345
567
EMPTY_CELL
EMPTY_CELL
EMPTY_CELL
EMPTY_CELL

Where are descending goes by

EMPTY_CELL
EMPTY_CELL
EMPTY_CELL
EMPTY_CELL
567
345
123

Currently im using this code/
$.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;
} );
}

Any help appreciated !!

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.