Closed matt-bernhardt closed 10 years ago
Sounds like something that should be fixed at the source in Mongo.
Hmm..not sure I agree. Mongo is reporting numbers, and not worrying about format. So it happy spits out "12345". The UI then takes that number and displays it. I'd tried to use number_format() in PHP to display the number as "12,345" - but another aspect of the UI, the datatables plugin, looks at "12,345" and depending on the documentation or forum response I consult sees a text string, or a European-format decimal. In order to avoid the problem with datatables, I removed the number_format() call and just let the number display as "12345".
Does this make sense? It might be faster to show in screenshots.
Ah, I see. You're doing preprocessing to the value in PHP. I thought it was text in the db. Sounds like DataTables should really provide an option for display options in that case.
For now, this has been resolved by removing the comma formatting. The numbers are harder to read, but not impossible - and the sort works.
When numeric values in tables are displayed with commas, they are interpreted by the DataTables plugin as text strings. A custom sort plugin may be needed. For now, I've stripped out the commas from numeric output.