How to sort <CMS_INCLUDE_OPTIONS type="database">
Author: Karsten
Publication Date: 12/5/2013 15:18
Hello,
I want to sort the values (_list.value.name) behind the selected checkboxes but don't know how. Has anyone an idea? Thanks
FORM
<CMS_INPUT_CHECKBOX name="cs_location" gridWidth="3" hFill="yes" sortOrder="ascending" useLanguages="no">
<CMS_INCLUDE_OPTIONS type="database">
<LABELS>
<LABEL lang="*">#item.name</LABEL>
</LABELS>
<TABLE>FSStoinside.news_locations</TABLE>
</CMS_INCLUDE_OPTIONS>
<LANGINFOS>
<LANGINFO lang="*" label="Show ONLY news of following location/department (optional)"/>
<LANGINFO lang="DE" label="NUR Nachrichten für folgenden Standort oder Abteilung anzeigen (optional)"/>
</LANGINFOS>
</CMS_INPUT_CHECKBOX>
HTML
$CMS_FOR(_list,cs_location)$
<li>$CMS_VALUE(_list.value.name)$</li>
$CMS_END_FOR$
Does not work!
$CMS_FOR(_list,cs_location.sort(x->x.value.name))$
Tags: cms_include_options, sort
-
Author: Peter_Jodeleit - 12/18/2013 10:30
cs_location (value type of CheckboxEditorValue) is a set and "sort" isn't supported for this datatype. You have to transform it to a list first. E.g. like this: [] + cs_location (i.e. adding all elements of the set to an empty list). The result than could be sorted: ([] + cs_location).sort(..)
tl;dr
Sort is only supported for lists.
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire