Jun 6, 2018, 4:08 PM
11 Posts

How to sort repeat control view columns

  • Category: Custom JSF code (Eclipse IDE)
  • Platform: Windows
  • Release: All
  • Role: Developer
  • Tags:
  • Replies: 2

Hi All,

I am using a repeat control view for my xpage and not sure how to put sorting options for every column like regular view control column headers. Please guide me. I designed just two columns but there will be 8 columns.

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:this.data>
        <xp:dominoView var="view1" viewName="Reserved"></xp:dominoView>
    </xp:this.data>
    
        <xp:table >
        <xp:tr>
            <xp:td>name</xp:td>
            <xp:td>type</xp:td>
        </xp:tr>
        <xp:repeat id="repeat1" rows="30" value="#{view1}"
            var="rowData" indexVar="rowIndex">
            <xp:tr>
                <xp:td>
                    <xp:text escape="true" id="computedField1"
                        value="#{rowData.Model}">
                    </xp:text>
                </xp:td>
                <xp:td>
                    <xp:text escape="true" id="computedField2"
                        value="#{rowData.Type}">
                    </xp:text>
                </xp:td>
            </xp:tr>
        </xp:repeat>
    </xp:table>  
    </xp:view>

Jun 7, 2018, 10:06 AM
298 Posts
That is up to you...
The repeat does not have sorting, it displays the data in whatever order your data is in.

So, you would have to develop your own sorting that will sort the data and redisplay the repeat control. Typically I get the data for the repeat via code and send an ArrayList of objects to the repeat (not a view). I suspect you would have to do that.


Howard
Jun 9, 2018, 3:06 PM
11 Posts
Thanks

Thanks Howard !!