Range Filtering on Price Ranges
Range Filtering on Price Ranges
Hi. Completely new to all this. I've just been having a look at the range filter example:
http://datatables.net/dev/accessibility/DataTables_1_10/examples/plug-ins/range_filtering.html
I managed to get something going on another table but it chokes on decimal points. Not familiar with JQuery enough to know if this is a data type issue or whether it was the comma vs decimal issue I'd read about in the docs somewhere.
Was interested in seeing if the custom min/max filter can handle price ranges (format would be something like 10.50, 100.00, 125.00 etc etc)
Didn't want to mess too much until I had more info on what the problem was likely to be be. It sorts the price rows okay but chokes when filtering the 2 decimal place format.
I could have understood more if I'd tried parsing Integers or something obvious.
Anyone have any ideas?
Answers
Hello Arndilly,
I used to code from the link you provided, altered the data to two decimals, and it worked fine. Did you alter the code? If so, please provide your code.
Bob Z.
Thanks for looking into it Bob Z. I got the example to work using the following:
var min = parseFloat( $('#min').val(), 10 );
var max = parseFloat( $('#max').val(), 10 );
var age = parseFloat( data[4] ) || 0;
Not completely convinced its the smartest solution - but it works.