Problem with NumericColumn sorting

Hi,

I’m preparing a custom report and I’m trying to make sorting by numbers
work. Here is the report I’m talking about:
https://github.com/dimagi/commcare-hq/blob/master/custom/m4change/reports/immunization_hmis_report.py.
As it is, sorting works fine, but only for strings. When I try to change
column type in the headers from DataTablesColumn to NumericColumn, it
doesn’t sort this column anymore. I can keep clicking on header but the
numbers are not being sorted properly (angle bracket next to the header
name does toggle its direction though). Do you happen to know if there
is a need to add something more in order to make NumericColumn sorting work?

Best regards
Pawel

Hi Pawel,

When you use a different sort type you need to have the data stored as
tuples using something like this:

There are lots of numeric sort examples in the sms reports here:

cheers,
Cory

··· On Wed, Feb 26, 2014 at 12:09 PM, Paweł Reise wrote:

Hi,

I’m preparing a custom report and I’m trying to make sorting by numbers
work. Here is the report I’m talking about: https://github.com/dimagi/
commcare-hq/blob/master/custom/m4change/reports/
immunization_hmis_report.py. As it is, sorting works fine, but only for
strings. When I try to change column type in the headers from
DataTablesColumn to NumericColumn, it doesn’t sort this column anymore. I
can keep clicking on header but the numbers are not being sorted properly
(angle bracket next to the header name does toggle its direction though).
Do you happen to know if there is a need to add something more in order to
make NumericColumn sorting work?

Best regards
Pawel

— You received this message because you are subscribed to the Google
Groups “CommCare Developers” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.