[Docs] Plugins : Sorting : "formatted-num" functions are backwards
[Docs] Plugins : Sorting : "formatted-num" functions are backwards
dharkness
Posts: 8Questions: 0Answers: 0
For example, formatted-num-asc(x,y) returns a number < 0 if x > y. The reason is that the -desc function is defined first, contrary to all of the other examples, but it has the code for the -asc version. Swapping -asc and -desc should solve the problem.
BTW, is there a way to get the numeric sType to ignore the comma thousands separators without using a custom function?
BTW, is there a way to get the numeric sType to ignore the comma thousands separators without using a custom function?
This discussion has been closed.
Replies
heh - getting good at this :-). Thanks for reporting this stuff that you are finding. This one is now also fixed.
The built in sorting and type detection functions don't, as you know, allow commas. As such the two ways around this are to (1) use a plug-in, or (2) replace/modify the built-in functions. So basically, no, I'm afraid that the plug-in is the best way to go... You could stick the sort and type detection plug-ins at the bottom of your DataTables.js file and then it will all just happen without any extra code in your main script.
Regards,
Allan
[code]if(x.indexOf('/')>=0)x = eval(x);[/code]
Has anyone else encountered this issue?
Allan
Here's a link: http://www.gotspace.mindsharestudios.com/?search-class=DB_CustomSearch_Widget-db_customsearch_widget&widget_number=preset-2&cs-all-0=&cs-listing_status-1=&cs-listing_price-2=&cs-listing_price-3=&cs-listing_city-4=&cs-listing_zip-5=&cs-listing_broker1-6=&cs-listing_type-7=retail&cs-listing_sqft-8=&cs-listing_sqft-9=&cs-listing_acres-10=&cs-listing_acres-11=&cs-listing_city-12=&search=Search
[code] y = y.replace('/','');
x = x.replace('/','');[/code]
But that seems to indicate that their is a problem with the regex in the plugin, right?