Page 1 of 1

sorting in Pop-up Form Control

Posted: Thu Sep 19, 2013 1:21 pm
by ehoeger
The documentation for Pop-up Form Control lists a property for sorting the values in the popup: sortRenderer. No example for the syntax of this property is given. I assumed it would be a pair like "sortRenderer, ascending" or "sortRenderer,descending". I tried this and a few variants but no joy. Any help appreciated.

Thanks
Burkhard

Re: sorting in Pop-up Form Control

Posted: Thu Sep 19, 2013 2:52 pm
by alex_jitianu
Hi,

There are two sides to the Pop-Up form control: the label that presents the current value(s) and the actual Pop-Up editor that appears when the user clicks on the previous mentioned label. That being said, the rendererSort only applies on the renderer part (the label) and when the editor is used with multiple selection (selectionMode set to multiple). The accepted values are indeed ascending and descending.

To give an example, if the user can select values: A, B, C in the editor and the sorting is set to descending the label will render: C, B, A.

I don't remember why we didn't offer the possibility to sort the values presented by the editor popUp too... I'll add an issue to create a new property editorSort to control this support. I'll also add an issue to update the documentation to better describe the behavior of rendererSort.

Meanwhile, if you can tell me where are the values presented by the editor taken from (Schema or CSS) perhaps I can offer an alternative solution. I can also send you the source code for the form control. It should be simple enough to make the editor sort it's values just like the renderer does. Please let me know if I should send it to you.

Best regards,
Alex

Re: sorting in Pop-up Form Control

Posted: Thu Sep 19, 2013 3:39 pm
by ehoeger
Thank you, now I understand. I was, of course, trying to do different, more like an "editorSort" property.
e.g. this css snippet produces a popup list of IDs pulled from a file containing a bibliography
and I was hoping to add a sort property to have the resulting list display in alphabetical order:

Code: Select all

msItem>listBibl>bibl>ref[target]:before {
content: oxy_editor(
type, popupSelection,
edit, "@target",
selectionMode,"single",
values, oxy_xpath('string-join(doc("../refsource/bibl.xml")//@xml:id, ",")'),
labels, oxy_xpath('string-join(doc("../refsource/bibl.xml")//@xml:id, ",")')) }
I think this might be useful for any list that is a bit longer (with either selectionMode -- multiple or single). Alternative suggestions would be very welcome. I am not much of a programmer but if you think that it would be not too difficult to make the editor sort in the same way as the renderer then, yes, please do send the code.



Thanks again,
Burkhard

Re: sorting in Pop-up Form Control

Posted: Thu Sep 19, 2013 5:14 pm
by alex_jitianu
Hello,

An easy solution would have been to use the saxon:sort() extension function in the XPath expression. Unfortunately Saxon extensions functions are not currently supported in the oxy_xpath function. That's another improvement for which I'll add an issue on our internal issue tracking tool.

Best regards,
Alex