1
votes

There is a Notes Client application which we want to rewrite it using XPages as we want to transform it into a XPiNC application. I will give you a simple example, explaining the Notes Client application:

There are one main form called ( let say ) Company and another form called Persons. From the company form the users can add multiple Persons. Of course, clicking the button Add Person from the Company form implies the current document ( Company ) to be saved - as the 2 forms have in common one field: txt_CName.

In the main frameset there is one outline entry containing a view ( which is categorized, based on this txt_CName ) to display the documents like this:

Company A doc.
    Person 1 from Company A
    Person 2 from Company A
Company B doc.
    Person 1 from Company B

I started already developing the XPiNC app. Regarding the Persons doc.: the users want completing the structure inside a dialog. OK ... but from the above view panel could I set the target to be computed ( when the link column is clicked ): Company A doc. to be opened in a normal way, but the Person 1 from Company A to be opened in the respective dialog - in other words to be computed. COuld you give me a simple example? Are there any other better solutions for my situation? ( excepting the classical functionality - from the Lotus Client app which I could developing using XPages )

Thanks for your time.

3

3 Answers

1
votes

I'd second Chintan's suggestion, a Repeat Control is a much better idea. If the View Panel gives you exactly what you want, use it. If it's not, my advidce is don't use it. It will be harder to manipulate it to work how you want than to reproduce the styling using a repeat control. After all, a View Panel is just a repeat control that can only display contents in a table and only one entry per row in a tabular format.

It sounds like nested repeats - the outer repeat showing companies, the inner showing people - will make your job easier. For the second repeat you have access to the var property from the first repeat, so that makes it easy. And a link column just displays a column from an XspViewEntry using a Link control, so that's easy to reproduce. The look and feel of a View Panel can be reproduced easily enough - just look at the styles of a View Panel in Firebug and you'll see the classes to set.

1
votes

I don't disagree with the nested xp:repeat approach. Clearly repeats offer the most flexibility, however, they can be difficult to get your head around and then you need to manage the entire "view" framework including view headers, footers, pagers, column headings, etc.

As a newbie you might consider the xe:dataView control as the parent view framework for the Company documents. The dataView comes with is own built in repeat in its details facet. Whatever you put in the details facet is repeated for each viewEntry in the dataView. So, into the details facet you could add a xp:viewPanel control with a categoryFilter to display the Person documents for the Company. Also, into the details facet add either an xe:dialog or xe:inPlaceForm control to create/edit the Person docs.

0
votes

Have you tried using the Extension Library dialog box? I hope this small example helps you.

//test.xsp
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xe="http://www.ibm.com/xsp/coreex">

    <xp:inputText id="inputText1"></xp:inputText>
    <xp:button value="Show Dialog" id="button1">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:getComponent("dialog1").show();}]]></xp:this.action>
        </xp:eventHandler></xp:button>
    <xe:dialog id="dialog1">
        <xp:text escape="true" id="computedField1">
            <xp:this.value><![CDATA[#{javascript:if(getComponent("inputText1"))
    if(getComponent("inputText1").getValue()!=null)
        return "The value is "+getComponent("inputText1").getValue();
    else
        return "";
else return "";         
    }]]></xp:this.value>
        </xp:text>

    </xe:dialog>
</xp:view>

Here, the idea is that, whenever you open the dialog box, it gets computed. So, if I understand you right, you could create one dialog box and insert the custom control for person form within it and then link the fields based on the what is clicked in the frontend company document.

Hope this helps.