JQuery Datatable custom sorting first column

JQuery Datatable custom sorting first column

Seshu ObbalareddySeshu Obbalareddy Posts: 1Questions: 1Answers: 0

I am using jQuery datatable - 1.9.4.

I have a gird with html elements inside it. Like drop-down, textbox.

I have implemented the custom sorting for the drop-down column. And the code is as shown below.

jQuery.fn.dataTableExt.oSort['select-sort-desc'] = function (x, y) {
x = $(x).find('option:selected').text();
y = $(y).find('option:selected').text();
}

Once the page is loaded and jQuery datatable is initialized. Sorting is working properly.

Also, we have functionality to add new rows to the grid.
So, once the new rows are added to the grid. I have re-initialized the datatable.

But, sorting for the new rows added is not working only for the first column which contains html drop-down inside it.

Answers

  • colincolin Posts: 15,118Questions: 1Answers: 2,583

    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.