Excluding Words from Filter Processing
Excluding Words from Filter Processing
A bit surprised its taking so long to find this as it seems common. Here it goes...
So I have data in a table that looks like....
1.72 miles
8.56 miles
12.34 miles
etc.
Problem is the filter treats it like a string when it includes miles (counts the decimal), so its not ordering numericly. So I'm either trying to find a way to remove " miles" before the sorting filter tries to process it, or I'm also fine with having the data initially just be numbers and then add miles after processing. In the end I want the user to still see miles, just the sorter not to take it into account.
I came across the render option, but anything there that gets displayed also ends up in the filter.
Any help would be greatly appreciated.
This question has an accepted answers - jump to answer
Answers
columns.render
is exactly what you need for this.The function will also give the
type
, and you can use that to only add miles for display purposes.Yup - orthogonal data is great for this sort of thing.
The other option is to use a sorting plug-in like this one which will strip everything but numeric data.
Allan
Thanks that worked. Here is the final code for anyone looking. In this case the column in question is the 6th one.