Martin Perrie
Martin Perrie

Reputation: 410

XPages - Sorting a filtered view

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.

Upvotes: 2

Views: 3016

Answers (2)

stwissel
stwissel

Reputation: 20384

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

Upvotes: 4

user618792
user618792

Reputation:

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>

Upvotes: 2

Related Questions