2
votes

I have a DominoView data source on my XPage that is filtered using a URL parameter so that only documents matching this parm are displayed.

The filtered documents then need to be sorted by the value of the second column (a status field). What would be the best approach to this?

The XPage is using jQuery Mobile for presentation and the documents would, ideally, be presented in a collapsible list with a separate collapsible for each status value.

Thanks for any tips.

2
do you use exactMatch on filtered value?Frantisek Kossuth
No, I've got keysExactMatch="false"Martin Perrie
with exact match to false you can't get values sorted by second column right from the view. so the only option is to resort collection of dataFrantisek Kossuth
Thanks for your advice. For this particular application requirement, this may be the way I need to go.Martin Perrie

2 Answers

4
votes

The easiest one is to have that view sorted in the second column too. No extra code required. You can have multiple sorted columns which don't need to be adjacent. Then you can have better filter keys. E.g you have 4 sorted columns: you use an array with 1-4 elements as filter. With 1 element it filters on the first column. With 2 elements it filters on the first and second column etc. The results are returned sorted by the remaining sorted columns

2
votes

Not sure if this will help your situation, but I was building a repeat with a view datasource that I needed to search based on a user's value I had stored in the sessionScope. When performing the search, I lost the default sort I had in the view. By adding sortColumn and sortOrder, I got the result I was looking for.

Here's a sample of the source;

    <xp:this.data>
    <xp:dominoView
        var="aprofiles"
        viewName="embAssessmentProfiles"
        sortOrder="ascending"
        sortColumn="apName">
        <xp:this.search><![CDATA[#{javascript:compositeData.searchFilter;}]]></xp:this.search>
    </xp:dominoView>
</xp:this.data>