1

anyone have a suggest to realize @Command([ViewShowOnlyUnread]) in XPages ViewPanel?

And is possibile realize the function "Next Unread" and "Previus Unread"?

1
  • For show unread document I use dojo.jquery() ------------------- dojo.query(".xspDataTable tr").forEach(function(node, index, arr){ if (node.className.indexOf("xspDataTableRowUnread")==-1){ node.className+=" lotusHidden" } console.log(node.className) }); ------------------- But there are nothing about the Next Unread and Preview Unread function Aug 22, 2012 at 13:48

3 Answers 3

4

Instead of binding the view panel to a standard view data source, try setting its value attribute to the following expression:

importPackage(com.ibm.xsp.model.domino);
var targetView = database.getView("Some View");
var unreadEntries = targetView.getAllUnreadEntries();
var unreadModel = new DominoViewEntryCollectionDataModel(unreadEntries);
return unreadModel;

The view panel should then behave exactly as it would if it were bound to a true data source, but only display the unread entries.

3
  • Uhhh very good point Tim, but...how can I insert your code so that when I click in the button can whitch datasouces? Tnx you very much Aug 23, 2012 at 7:35
  • I have try your code in static Mode but generate this error: Error while executing JavaScript computed expression Script interpreter error, line=5, col=8: Cannot find java public constructor 'com.ibm.xsp.model.domino.DominoViewEntryCollectionDataModel()' Aug 23, 2012 at 8:07
  • I have changed the last line with return (unreadModel); But don't seem work your solution in my view... The VAR variable don't pass correct class and go in error... I don't know Aug 23, 2012 at 8:17
1

Excellent answer from Tim..

Here's other version with Repeat Controls -

    <xp:repeat id="repeatUnreadEntries" var="viewEntry" indexVar="index" rows="30">
    <xp:this.value><![CDATA[#{javascript: return database.getView('viewName').getAllUnreadEntries()}]]></xp:this.value>
    <xp:this.facets>
        <xp:panel id="repeatHeader" xp:key="header">
            <xp:text disableTheme="true" escape="false">
                <xp:this.value>
                    <![CDATA[<TABLE><THEAD><TH>Cell1</TH><TH>Cell2</TH></THEAD><TBODY>]]>
                </xp:this.value>
            </xp:text>
        </xp:panel>
        <xp:panel id="repeatFooter" xp:key="footer">
            <xp:text disableTheme="true" escape="false">
                <xp:this.value><![CDATA[</TBODY></TABLE>]]></xp:this.value>
            </xp:text>
        </xp:panel>
    </xp:this.facets>
    <TR>
        <xp:repeat var="entryColVal" indexVar="colIndex" value="#{javascript:viewEntry.getColumnValues()}">
            <TD>
                <xp:text value="#{entryColVal}" />
            </TD>
        </xp:repeat>
    </TR>
</xp:repeat>
0

The code provided by Tim Works if you set data and value attributes to view panel, like below.

<xp:viewPanel rows="30" id="viewPanel1">
    <xp:this.facets>
        <xp:pager partialRefresh="true" layout="Previous Group Next" xp:key="headerPager" id="pager1"></xp:pager>
    </xp:this.facets>
    <xp:this.data>
        <xp:dominoView var="view1" viewName="vwSrc"></xp:dominoView>
    </xp:this.data>
    <xp:this.value><![CDATA[#{javascript:importPackage(com.ibm.xsp.model.domino);
var targetView = database.getView("vwSrc");
var unreadEntries = targetView.getAllUnreadEntries();
var unreadModel = new DominoViewEntryCollectionDataModel(unreadEntries);
return unreadModel();}]]></xp:this.value>
        <xp:viewColumn columnName="col1" id="viewColumn1">
            <xp:viewColumnHeader value="Column1" id="viewColumnHeader1"></xp:viewColumnHeader>
        </xp:viewColumn>
</xp:viewPanel>
5
  • I don't know why..but in my scenario if I cut and paste the code...I see the vwSrc complete with all entries... I Use 8.5.3FP2 Server and Designer.... Aug 23, 2012 at 15:00
  • Did you modified the view name in data attribute and value attribute as well??. Other than that i don't see any issue... Aug 23, 2012 at 15:19
  • Yes....the name in data attribute and the value attribute are the same...Have you try the code and in your scenario work well? Aug 23, 2012 at 16:18
  • i tried it and it worked well. If you still have problems with this code, you can use repeat control as provided in my answer. Aug 23, 2012 at 18:55
  • Tnx you, but I can't use a repeat control, my view have different categorization and is more complex because have indentation with response document etc... Now I try the test with a simple view. Tnx Aug 24, 2012 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.