Sorting does not work as required! Pls help!

Sorting does not work as required! Pls help!

naseemnaseem Posts: 4Questions: 0Answers: 0

Hi there, one of my columns consist of monetary value (cost) and when I hit sort, it only sorts it alphabetically. This table was generated from a dataframe to HTML. This column in the dataframe had data type float64. Can anyone help. Heres an example when I hit low to high: 120.90, 20495.45, 21.47, 345.01, 45.00.

It just looks at the first digit.

Replies

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922

    If Datatables thinks its a non-numeric column you may have some other non-numeric data in the column. You can try using column.type and set it to num. If this doesn't work then we 'll need to see an example of the problem. Please post a link to your page or a test case replicating the issue.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • naseemnaseem Posts: 4Questions: 0Answers: 0

    Thanks Kevin for the speedy reply! So youre completely right.. some of the data had a NaN type, so I took them out and it worked a treat :) thanks.

This discussion has been closed.