You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the helpers.format function to return numbers with commas included, helpers.format("{0:,}") to be specific, but I'm having an issue because if I click the column to sort the results they are getting returned as if the column were a text (non-numeric) field. Below is the order that the results are getting returned. Here is a screenshot of the table results.
7,786
52
5,406
43
4,692
4
318
2,857
158
1,676
What can I do to have them be returned in the correct order (7,786 > 5,406 > 4692, and so on)?
My development environment is the following:
Django 1.6.5
Python 2.7.5
django-datatable-view 0.7.1
The text was updated successfully, but these errors were encountered:
If the field is calculated and not actually available at the query level, you can specify a model method/property name, and then you'll have to return a 2-tuple of data from your datatable callback so that it knows what is "formatted" and what is "raw":
I think this managed to escape full documentation. I'll see what I can do to add that in. It's not the kind of thing you want to be forced into doing often, but let me know if it changes anything.
Hm... does the middle argument of the column definition correctly reflect a database value, or is it computed via a method?
It's computed by a method.
If the field is calculated and not actually available at the query level, you can specify a model method/property name, and then you'll have to return a 2-tuple of data from your datatable callback so that it knows what is "formatted" and what is "raw"
I am using the helpers.format function to return numbers with commas included,
helpers.format("{0:,}")
to be specific, but I'm having an issue because if I click the column to sort the results they are getting returned as if the column were a text (non-numeric) field. Below is the order that the results are getting returned. Here is a screenshot of the table results.What can I do to have them be returned in the correct order (7,786 > 5,406 > 4692, and so on)?
My development environment is the following:
The text was updated successfully, but these errors were encountered: