Jul 10, 2012 5:38 PM
68 Posts
topic has been resolvedResolved

Additional param in ViewControl.

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: End user,Developer,Administrator
  • Tags:
  • Replies: 8
Hi I want to add additional parameter after clickin in link (in ViewControl) for example:
 
This is normal link:
 
http://localhost/test.nsf/%24%24OpenDominoDocument.xsp?documentId=16EAE326CB485815C1257A0F004DD8D2&action=editDocument 
 
I want to Add new param like:
 
http://localhost/test.nsf/%24%24OpenDominoDocument.xsp?documentId=16EAE326CB485815C1257A0F004DD8D2&action=editDocument&content=test
 
Question is how can I do this ?
Jul 11, 2012 3:06 AM
126 Posts
Re: Additional param in ViewControl.
Theres a property for this in the all properties view for the link control: 
 
<xp:link text="link" value="mobile.xsp">
     <xp:this.parameters> 
          <xp:parameter name="test" value="value"></xp:parameters> 
     </xp:this.parameters> 
</xp:link> 
Jul 11, 2012 4:17 AM
68 Posts
Re: Additional param in ViewControl.
I don't know if you understand me good but here is sample code that don't work:
 
    <xp:viewPanel rows="30" id="viewPanel1" viewStyle="width:100.0%">
        <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="vAnkiety"></xp:dominoView>
        </xp:this.data>
        <xp:viewColumn columnName="Tytul_Ankieta" id="viewColumn1"
            displayAs="link">
        <xp:link text="link">
     <xp:this.parameters>
          <xp:parameter name="test" value="value"></xp:parameter>
     </xp:this.parameters>
        </xp:link>
            <xp:viewColumnHeader value="Tytuł Ankiety:"
                id="viewColumnHeader1">
            </xp:viewColumnHeader>
        </xp:viewColumn>
    </xp:viewPanel>
Jul 11, 2012 5:35 AM
43 Posts
Re: Additional param in ViewControl.
 
 You can do something like this:
 

<xp:viewColumn columnName="cName" id="viewColumn1"  value="">

<xp:link escape="true" id="link1">
<xp:this.text><![CDATA[#{javascript:viewEntry.getColumnValue("$92");}]]></xp:this.text>  // Write down the text which you want to be dispayed as the value is empty
<xp:eventHandler event="onclick"
submit="false">
<xp:this.script><![CDATA[var docid='#{javascript:viewEntry.getColumnValue("$96")}';

var link="";
var typ='#{javascript:viewEntry.getColumnValue("aTyp")}';
link='xx_openPage.xsp?aTyp='+typ+'&action=openDocument&documentId='+docid;
window.open(link,'New','width=1000, height=650, left=250px, top=250px, menubar=no, resizable=0, scrollbars=yes');

]]></xp:this.script>
</xp:eventHandler>
</xp:link>

<xp:viewColumnHeader value="Titel"
id="viewColumnHeader10" sortable="true">
</xp:viewColumnHeader>
</xp:viewColumn>
 
The blue part would be your link. 
 
Hope this helps. 
 
Regards, 
CHINTAN P. 
Jul 11, 2012 5:42 AM
126 Posts
Re: Additional param in ViewControl.
I see now, now you can't simply drop another control inside it and use its attributes / functionality. The text that you where clicking on was coming from the viewPanel but you
had the params set on the link which had no text and wasn't being clicked. The below will do what your looking for:
 
**Note: I changed some of the values to test it on teamroom** 
 
<xp:viewPanel rows="30" id="viewPanel1" viewStyle="width:100.0%" var="rowData">
        <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="xvwDocsByActiveDate"></xp:dominoView>
        </xp:this.data>
        
        <xp:viewColumn columnName="$143" id="viewColumn1"
        displayAs="link">
        <xp:this.pageUrl><![CDATA[#{javascript:
        return "/topicThread.xsp?documentId=" + rowData.getUniversalID() + "&test=value";
        }]]></xp:this.pageUrl>
        <xp:viewColumnHeader value="Topic" id="viewColumnHeader1">
        </xp:viewColumnHeader>
        </xp:viewColumn>
</xp:viewPanel>  
Jul 11, 2012 9:33 AM
68 Posts
Re: Additional param in ViewControl.
 getUniversalId give me somethign like this : E262CE1D1CB9BBABC12579C90074B659 (and this is not working)
and i need somthing like this: 16EAE326CB485815C1257A0F004DD8D2 or normal getNoteId (but this isn't working)
Jul 11, 2012 9:49 AM
126 Posts
Re: Additional param in ViewControl.
?, getUniversalID() returns the universal id of the document that has been clicked. In Xpages urls like this:
 
http://<server>/<app>/<xpage>?documentId=21312f3hg1f42gf342gvf4hg2v4h2v42    etc. 
 
the code following the word "documentId" is that documents universal id, getNoteId() returns a different ID that is not suitable for this to work, that is how the backend works. As I said I dropped it into a test XPage on the teamroom application and it worked fine, the ID after documentId should be changing for every document you click on as it would return a different value for each.
 
Try going to the view and adding a column with the documents ID and see are they matching whats in the URL, if so something is going wrong with the way your trying to use this / open the document.
 
e.g. lotus formula for getting the ID is :   @Text(@DocumentUniqueID)      simply copy that into a new column and compare them to the URL if they are the same its an issue with something else. If your still getting this issue please post details about what isn't working / what your seeing on the screen, plus:
 
1. The code you've used in the viewPanel 
2. The URL your getting + what you think you should be 
3. How your trying to open / display the document 
Jul 11, 2012 2:24 PM
68 Posts
Re: Additional param in ViewControl.
Without any parameters link look like that:
 
/%24%24OpenDominoDocument.xsp?documentId=16EAE326CB485815C1257A0F004DD8D2&action=editDocument
 
Code:
 
     <xp:viewPanel rows="30" id="viewPanel1" viewStyle="width:100.0%">
        <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="vAnkiety"></xp:dominoView>
        </xp:this.data>
        <xp:viewColumn columnName="Tytul_Ankieta" id="viewColumn1"
            displayAs="link">
            <xp:viewColumnHeader value="Tytuł Ankiety:"
                id="viewColumnHeader1">
            </xp:viewColumnHeader>
        </xp:viewColumn>
    </xp:viewPanel>
 
With your parameters
 
Url looks like that:
 
/xAnkieta_Detale.xsp?documentId=E262CE1D1CB9BBABC12579C90074B659&action=editDocument&test=value  
 
 
Code:
 
    <xp:viewPanel rows="30" id="viewPanel1" viewStyle="width:100.0%">
        <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="vAnkiety"></xp:dominoView>
        </xp:this.data>
        <xp:viewColumn columnName="Tytul_Ankieta" id="viewColumn1"
            displayAs="link">
            <xp:this.pageUrl><![CDATA[#{javascript:return "/xAnkieta_Detale.xsp?documentId=" + view1.getUniversalID() + "&action=editDocument&test=value";}]]>
            </xp:this.pageUrl>
            <xp:viewColumnHeader value="Tytuł Ankiety:"
                id="viewColumnHeader1">
            </xp:viewColumnHeader>
        </xp:viewColumn>
    </xp:viewPanel>
 
 
What more such url is working (ID is from 1st option);
 
/xAnkieta_Detale.xsp?documentId=16EAE326CB485815C1257A0F004DD8D2&action=editDocument&test=value
 
To sum up getUniversalID give such an id: E262CE1D1CB9BBABC12579C90074B659
Normal way give such an id:  16EAE326CB485815C1257A0F004DD8D2
 
But in normal way I can't add additional parameter so I need get somehow this id (16EAE326CB485815C1257A0F004DD8D2)
 

Jul 12, 2012 3:10 AM
126 Posts
Re: Additional param in ViewControl.
Your issue is that your using
 
view1.getUniversalID();
 
in your code this is the "var" attached to the domino view, in my code sample I attached a "var" property "rowData" to my viewPanel and used
 
rowdata.getUniversalID()
 
The ID your getting is a static id for the view and not for the document your clicking on. Make that change and it should be fine