Arun
Arun

Reputation: 329

Xpages: Dynamic View Panel - Sorting

In my dynamic view panel, I need to have sortable columns. Problem is when sorting a column it resubmits the XPage and whole content is refreshed. Is there a way to achieve sorting only on the dynamic view panel without submitting whole page? Also, I want to hide this control if selected view is empty.

Here is my code:

<xp:panel id="searchPanel">
            <xp:table styleClass="table table-condensed" style="width:auto">
                <xp:tr>
                    <xp:td style="border-top:0px" styleClass="text-nowrap" id="searchColumn">
                        <xp:inputText id="inputText1" value="#{viewScope.searchterm}" styleClass="form-control"></xp:inputText>
                        <xp:link escape="true" text="" id="searchLink">
                            <i class="fa fa-search" style="margin-left:5px"></i>
                            <xp:eventHandler event="onclick" refreshMode="partial" immediate="false" submit="true" refreshId="ddPanel">
                                <xp:this.action><![CDATA[#{javascript:var pager:com.ibm.xsp.component.xp.XspPager = getComponent("pager");
pager.gotoFirst();}]]></xp:this.action>
                            </xp:eventHandler>
                        </xp:link>
                        <xp:link escape="true" text="" id="clearSearchLink">
                            <i class="fa fa-times" style="margin-left:5px"></i>
                            <xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="ddPanel" onComplete="showHideTableToggle()">
                                <xp:this.action><![CDATA[#{javascript:viewScope.remove("searchterm");}]]></xp:this.action>
                                <xp:this.script><![CDATA[dojo.byId(getID("inputText1")).value=""]]></xp:this.script>
                            </xp:eventHandler>
                        </xp:link>
                    </xp:td>
                    <xp:td style="border-top:0px;padding-left:20px">
                        <xp:link escape="true" id="addButton" onclick="return false;" styleClass="btn btn-primary" style="color:rgb(255,255,255)" text="Add">
                            <i class="fa fa-plus" style="margin-right:5px"></i>
                            <xp:eventHandler event="onclick" submit="false" refreshMode="complete">
                                <xp:this.script><![CDATA[XSP.openDialog(getID('contentDialog'),'',{"docID":"","newDoc":"false"});]]></xp:this.script>
                            </xp:eventHandler>
                        </xp:link>
                    </xp:td>

                </xp:tr>
            </xp:table>
            <xp:panel id="ddPanel">
                <xe:dynamicViewPanel id="mainView" width="100%" dataTableStyleClass="table table-bordered table-condensed table-hover" rows="10" var="myView"
                    showColumnHeader="true" customizerBean="com.hcl.igdm.PickerViewBeanMainViews" partialRefresh="true" refreshId="ddPanel"
                >
                    <xe:this.data>
                        <xp:dominoView var="mainDataView" dataCache="nodata">
                            <xp:this.viewName><![CDATA[#{javascript:sessionScope.showView.split("~")[0]}]]></xp:this.viewName>
                        </xp:dominoView>
                    </xe:this.data>
                    <xe:this.rowAttrs>
                        <xp:attr name="onClick">
                            <xp:this.value><![CDATA[#{javascript:return "javascript:myJSFunction();"}]]></xp:this.value>
                        </xp:attr>
                    </xe:this.rowAttrs>
                </xe:dynamicViewPanel>
                <xp:pager layout="Previous Group Next" partialRefresh="true" id="pager" for="mainView" title="Pager"></xp:pager>
            </xp:panel>

Upvotes: 0

Views: 430

Answers (1)

Adrian
Adrian

Reputation: 173

It's a long time ago this question was placed... but maybe the answer can help other people.

You can put the dynamicViewPanel into a 'dynamic content' container (from ExtLib) with partial events attribute set to true. This will convert the full update events into partial refresh events.

<xe:dynamicContent partialEvents="true">
    ...
</xe:dynamicContent>

Upvotes: 1

Related Questions