mixed column with prices order wrong?
mixed column with prices order wrong?
Talie
Posts: 6Questions: 2Answers: 0
it's a mixed column with multiple text elements, not just currency amounts... i can't figure out why the currency amounts aren't sorting properly (for instance $10,000 is showing as higher than $14,000, $6,500 above $7,500). please help!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
You have non-numeric content in that column as well as the numeric content, which is why it isn’t sorting correctly. I’m using an iPad at the moment, and frustratingly can’t workout how to “view source”, so I can’t see exactly what is going on, but most likely you’ll need to use orthogonal data which will give a numeric value for that column for the sorting information (e.g. sold might be given as 0 or Infinity allowing it to be sorted numerically).
Allan
hi Allan. it does seem to be able to recognize/sort the sold/pending/for sale into groups, but for some reason it doesn't seem to recognize the $ amounts and sort them by highest to lowest, which is a bit counter-intuitive. i can't figure it out!
i've tried adding data-order with only the price, thinking perhaps it was confused by the formatting/extra type, and it made no difference.
i was reading about renderers, and would be happy to edit my current price structure from $X,XXX to XXXX but despite the examples, i can't figure out how (or more importantly WHERE) to fit
into the code! i tried to fit it somewhere into
but couldn't get it to work. i'm a designer by trade, not a programmer, so i'm feeling well out of my depth. any assistance would be greatly appreciated.
(and also, thanks for the reply Allan)
The Natural sorting plugin might work for your data. I copied your table and Datatable config into this test case:
http://live.datatables.net/nugeyixa/1/edit
I installed the natural sorting plugin code in the HTML tab and assigned it to the
status
column. It seems to sort correctly now. Let us know if this works for you.Kevin
Kevin, that did the trick -- thank-you so much for the help (and for dumbing it down for me/showing me the working example!). so very much appreciated!