Sort is not working properly
Sort is not working properly
Waed
Posts: 7Questions: 2Answers: 0
Hello,
I'm using the dataTable plugin but the sort is not working or to be clear it works but not in a fully correct way
should I customize it first or no need
also does it work with negative numbers
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Without seeing the issue its hard to say what is wrong. 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
Thanks for your fast response.
this is the link
http://stations.arabiaweather.com/stations-list/JO
I think I get the idea. One option is to use Orthogonal Data to extract the number from the data for the
filterandsorttypes.Kevin
any way to use it ? or should I replace my code with a new one
I would really appreciate the extra info
Assuming your original data looks like something this
1016.8 مليبارthen the Computed Example is what you want to use. Except you would modify the data for thesortandfiltertype. You would use normal Javascript methods to extract the portion of the data you are interested in.You can use
columns.targetsto apply the samecolumns.renderfunction to multiple columns.Kevin
I think this is not my problem,
the issue is that sort work for the first digit from the left so for example 20 is bigger than 111 because 2 is bigger than 1
51
6
63
7
72
like this. this is a string sort, not a numeric one
I checked the type of my data and I have numbers
nothing helpful in the manual that I can use
Hi @Waed ,
As @kthorngren said,
columns.renderis the way to go here. The column is being treated as a string as it contains non-numeric data - by giving values for thesortin-options columsn.renderyou can return the numeric value to order on.Cheers,
Colin