Can dataTables sort price range column
Can dataTables sort price range column
lpranger
Posts: 11Questions: 1Answers: 0
A simple example is this of a column before an asc and desc sort
$129 – $169
$135
$80.11 – $98.11
$109
$102.60 – $125.11
I can't find or figure out a working example
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I retyped the numbers in a column sorry
A simple example is this of a column before an asc and desc sort
$129 – $169
$135
$80.11 – $98.11
$109
$102.60 – $125.11
I can't find or figure out a working example
So some cells of the table contain text of the form "$123.45 - $234.56"?
Yes, exactly.
I would like to sort like this
$40
$45.25 - $50.00
$80.11 - 98.11
$95
$102.60 - $125.11
$525.22
Seems to just work for me... I have an example here
Can you modify that to show the problem you're having?
I added to your set up, about 6 rows of data. The rows are added via the back end and I am just applying the datatable js with the proper init options.
It's different how you were loading the data.
It's pretty straight forward.
Sorry Rhino,
I believe this is my example.
http://live.datatables.net/cipecex/1/edit
Rhino,
Did you have a chance to check out my example?
Hi Ipranger, I'm sorry for the long delay! I let it drop off my radar :(
Anyway, I think I may have found a fix for you. I modified your example, and it seems to work. How's that look?
Oh, and the render function can be shortened to:
Thanks a Bunch!!!
@rhino - nice solution using orthogonal data. I was going to suggest using a plug-in sorting data type, but this is a nice way of doing it.
Allan