Xpages:DataView可以对类别列进行排序

时间:2016-06-01 18:13:15

标签: xpages

我的基础视图按分类列排序。我已选择此列进行排序。视图中没有真正的列标题。

有什么方法吗?也许放一个按钮以编程方式切换排序?

<xe:dataView 
            id="dataView1" 
            style="margin-top:55.0px"
            openDocAsReadonly="true" 
            var="entry" 
            rows="25" 
            columnTitles="true"
            showCheckbox="true" 
            showHeaderCheckbox="true">
            <xe:this.data>
                <xp:dominoView var="view1"
                    databaseName="scoApps\Spectrum\cashmarkData.nsf"
                    viewName="(view01)"
                    search="#{javascript:return sessionScope.searchString}"
                    sortColumn="author" />
            </xe:this.data>
            <xe:this.summaryColumn>
                <xe:viewSummaryColumn 
                    columnName="subject"
                    columnTitle="Subject" />
            </xe:this.summaryColumn>
            <xe:this.categoryColumn>
                <xe:viewCategoryColumn 
                    columnName="author"
                    columnTitle="Author" 
                    style="font-weight:bold;font-size:14pt" />
            </xe:this.categoryColumn>
            <xe:this.extraColumns>
                <xe:viewExtraColumn 
                    columnTitle="Date Created"
                    columnName="creationDate" 
                    headerStyleClass="xspDataViewColumn150"
                    styleClass="xspDataViewColumn150" />
            </xe:this.extraColumns>
            <xp:this.facets>
                <xe:pagerExpand 
                    id="pagerExpand1" 
                    xp:key="pagerTopLeft"
                    partialExecute="true" 
                    partialRefresh="true" 
                    for="dataView1">
                </xe:pagerExpand>
                <xp:pager 
                    layout="Previous Group Next"
                    partialRefresh="true" 
                    id="pager1" 
                    xp:key="pagerBottomLeft"
                    partialExecute="true" />
                <xp:scriptBlock id="scriptBlock2"
                    xp:key="pagerBottom">
                    <xp:this.value><![CDATA[$("table.dataview").addClass("table-striped table-hover table-bordered table-condensed")]]></xp:this.value>
                </xp:scriptBlock>
            </xp:this.facets>
        </xe:dataView>

1 个答案:

答案 0 :(得分:0)

我之前使用DataTable做过。在我的专栏中,我通过链接

设置了排序列
<xp:column id="column9">
                    <xp:this.facets>
                        <xp:div id="div8" xp:key="header" styleClass="team">
                            <xp:link escape="true" text="Team" id="link7" styleClass="sort">
                                <xp:eventHandler event="onclick" submit="true"
                                    refreshMode="partial" refreshId="dataTablePanel">
                                    <xp:this.action>
                                        <xp:executeScript>
                                            <xp:this.script><![CDATA[#{javascript:viewScope.sortColumn = "Team"}]]></xp:this.script>
                                        </xp:executeScript>
                                    </xp:this.action>
                                </xp:eventHandler>
                            </xp:link>
                        </xp:div>
                    </xp:this.facets>
                    <xp:text escape="true" id="computedField14">
                        <xp:this.value><![CDATA[#{javascript:entry.getColumnValue("Team")}]]></xp:this.value>
                    </xp:text>
                </xp:column>

在我的DominoView数据源中,我按

计算sortColumn
sortColumn="#{javascript:viewScope.get("sortColumn")}"

refreshId指向我的DataTable周围的面板