Priority: Normal
Current State: Closed
Released In:
Target Release: n/a
I could not get the
sort
by form field to work for
%TABLEFORMAT%
. I noticed it was sorting by topic name when I was doing
sort="name"
. Eventually I got it working by doing
sort="MyForm.MyField"
. But then I noticed that numeric sorting and probably reverse sorting are broken anyway. So I came up with a workaround in
TableFormat.pm
but it probably breaks other kind of sorting. I have a feeling that this should really be fixed in
DBCacheContrib/Map.pm get sub.
Anyhow I change a few lines in the
_compare
function:
if ( $field->{reverse} ) {
# reverse sort this field
$va = $b->get($b->get('form') . '.' . $field->{name} );
$vb = $a->get($a->get('form') . '.' . $field->{name} );
} else {
$va = $a->get($a->get('form') . '.' . $field->{name} );
$vb = $b->get($b->get('form') . '.' . $field->{name} );
}
All I did is adding the concatenation with the form name.
--
TWiki:Main/StephaneLenclud - 29 Jan 2007
Turns out that the whole thing is not broken at all. Only the documentation needs updating. Numeric sorting and I assume reverse sorting work fine when doing something like
sort=#MyForm.MyTopic
.
--
TWiki:Main.StephaneLenclud - 29 Jan 2007
Item3537 also require
FormQueryPlugin documentation update.
--
TWiki:Main.StephaneLenclud - 30 Jan 2007
I can't see anything wrong with the documentation; the requirement to use # for a numeric sort is clearly documented; see
http://foswiki.org/Extensions/FormQueryPlugin#SortOrder - I added an anchor link to try and make it clearer.
--
CrawfordCurrie - 07 Apr 2009