Sorting Dates, with empty cells and TBD text in cells. Only dates at the top?

Sorting Dates, with empty cells and TBD text in cells. Only dates at the top?

adamladaml Posts: 1Questions: 1Answers: 0

Somewhat new to DataTables I'm setting up a simple data table with a date column that needs to have dates sorted. That same column contains dates, empty cells and "TBD" text in some cells. I'd like the dates to sort but everything else to stay at the bottom.

I tried a few ideas. .sort being the obvious but it didn't produce the output I was looking for so tried the .map below which does nothing to the columns data (no sorting) although the console.log looks good, valid dates are true and others not. Anyone have any ideas? Thanks

$.extend(true, $.fn.dataTable.defaults, {
    columns: [
        {"orderDataType": "dom-text-date"}
    ]
});
$.fn.dataTable.ext.order['dom-text-date'] = function (settings, col) {
    console.log(settings, col);
    return this.api().column(col, {
        order: 'index'
    }).nodes().map(function (td, i) {
        return moment($(td).text()).isValid() ? 'false' : 'true';
    });
}
This discussion has been closed.