Bitwyse1
Bitwyse1

Reputation: 339

viewPanel getDocument returning an error

I have the following code in an xPage

<xp:viewPanel rows="30" id="viewPanelAuditDocuments"
    width="50%">
    <xp:this.data>
        <xp:dominoView var="varFilesByPropNoYearCat"
            viewName="vwFilesByPropNoYearCat" expandLevel="3">
            <xp:this.categoryFilter><![CDATA[#{javascript:
if( viewScope.containsKey( "selectedProperty" ) )
        mySelectedProperty = @Word( viewScope.selectedProperty, " - ", 1 );
else
    mySelectedProperty = viewScope.selectedProperty = "-Select a Property-";

return mySelectedProperty;
                    }]]>
        </xp:this.categoryFilter>
    </xp:dominoView>
</xp:this.data>
<xp:viewColumn columnName="Year" id="viewColumn2"
    showCheckbox="true">
    <xp:viewColumnHeader value="Year"
        id="viewColumnHeader2">
    </xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="Category" id="viewColumn3">
    <xp:viewColumnHeader value="Category"
        id="viewColumnHeader3">
    </xp:viewColumnHeader>
</xp:viewColumn>
<xp:viewColumn columnName="FileName" id="viewColumn4"
    contentType="html" displayAs="link">
    <xp:this.pageUrl><![CDATA[#{javascript:
jsLibGetAttachmentURL( varFilesByPropNoYearCat.getDocument().getUniversalID(), FileName );}]]>
    </xp:this.pageUrl>
    <xp:viewColumnHeader value="File Name"
        id="viewColumnHeader4">
    </xp:viewColumnHeader>
</xp:viewColumn>
<xp:this.facets>
    <xp:pager partialRefresh="true"
        layout="FirstImage PreviousImage SeparatorPage Group NextImage LastImage"
        xp:key="footerPager" id="pager2" for="viewPanelAuditDocuments"
        alwaysCalculateLast="true">
    </xp:pager>
    <xp:viewTitle xp:key="viewTitle" id="viewTitle1"
        styleClass="lead color:red">
        <xp:this.value><![CDATA[#{javascript:viewScope.selectedProperty;  }]]></xp:this.value>
        </xp:viewTitle>
        <xp:inputHidden id="viewPanelSelectedIds"
            xp:key="southEast" />
    </xp:this.facets>
</xp:viewPanel>

In the fileName column I am trying to compute a url to open the displayed file attachment name.

When I open the page I get the following error: Script interpreter error, line=2, col=88: [TypeError] Error calling method 'getDocument()' on an object of type 'lotus.domino.local.View [Static Java Interface Wrapper, lotus.domino.local.View: lotus.domino.View]' 1: jsLibGetAttachmentURL( varFilesByPropNoYearCat.getDocument().getUniversalID(), FileName );

How else do I get the universal ID for a document in a view panel?

Upvotes: 0

Views: 408

Answers (1)

Jesse Gallagher
Jesse Gallagher

Reputation: 4471

I think you should specify a var in the xp:viewPanel and then use that, such as viewEntry.getUniversalID(). The variable varFilesByPropNoYearCat will resolve to the whole view, not an individual entry.

Upvotes: 2

Related Questions