On Oct 12, 10:41 am, blues <[email protected]> wrote:
> i guess this passed unnoticed. from the 3.2.1 changelog:
>
> On Oct 8, 5:06 pm, The Editor <[email protected]> wrote:
> > * Changed sort function to natsort, to get more natural sorting of numbers.
>
> i am still getting numbers sorted as strings in a report like this:
>
> [(info report target=target.page sort=value count=10 template=templ)]
i tried to give a look into the code, and i see why this doesnt work
for info reports.
in the function BOLTinfo (line ~235) when sort=value a ksort is
performed without relying on the BOLTsort function (which uses the
natsort).
unfortunately ksort treats the keys as strings and there is no
equivalent for sorting keys as numbers. probably the array should be
sorted before flipping the key with the value.
yes, i tried it and it works.
temporary fix:
putting the sort before the flipping, at line ~228
if (isset($infosort)) {
if ($infosort == 'field') ksort($info);
elseif ($infosort == 'value') natsort($info);
}
and after the call to BOLTsearchPageListPlus (line ~236)
if (($infosort != 'field') && ($infosort != 'value')) $args['sort'] =
$infosort;
could it be fixed in the core? of course you are free to adapt it to
your code style, and it can probably be optimized.
blues
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---