DataTable column sorting incorrectly

Isaac used Ask the Experts™
I have a dataTable and I'm populating the table with data from a list.  One of my columns in the datatable is a textbox for users to manipulate.  In SharePoint, the column is a number column.  I do notice that when I sort it in the dataTable, it's not sorted correctly, even if I force it with a parseInt.  If not in a textbox, it sorts correctly. See pic below.

DT Table
Any ideas how to fix?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
It's sorting as a string instead of sorting as a number.  To correct that, set the column data type.

$('#example').dataTable( {
  "columnDefs": [
    { "type": "num", "targets": 3 }
} );

Open in new window

"targets" is the column number.  The first column is 0.

Here's the documentation:
IsaacSharePoint Client Side Developer


Thank you so much!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial