0
votes

I am working to place an XPage front-end on an existing Notes app that has many views. Right now, I am building the XPages and Custom Controls (CCs) in a separate NSF from the existing App/Data. (Not a requirement, but I offer this in case it affects your answer.)

Planning for maintenance, I was hoping to build a minimum of reusable XPages/CCs. I realize I may need a separate CC for each underlying Notes View, but I was hoping to reuse one or a few XPages and decide at run-time what view should be displayed in a "content" panel/div. (A "computed Custom Control"?)

In addition, I was hoping to provide a left menu/list of views on the XPage that would (1) allow view selection via click and (2) visually indicate which view was selected (again, targeting reusability... not a menu for each view.)

(Notes App parallel: A frameset with an outline in the left frame and a content frame for loading views selected from the outline.)

Any suggestions, resources, links, pointers, etc. would be very appreciated.

Also, in your reply, please assume that I cannot use the Extensions Library.

Thank you for helping an obviously new XPages developer.

4
Why are you not able to use Extension Library (or Upgrade Pack 1)? - Per Henrik Lausten
The application will be distributed and I cannot control or dictate that the customer install the Extension Library. I need a "lowest common denominator" solution. I am hoping to run on stock Domino 8.5 and up. - Grant Lindsay
I suppose that another way I could have asked my question is, How did developers handle non-trivial numbers of views in XPages before the advent of the Extension Library? - Grant Lindsay

4 Answers

3
votes

You could use URL parameters to control which view will be displayed. To to this you can create a XPage which has the columns computed like this:

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

<xp:viewPanel rows="30" id="viewPanel1">
    <xp:this.data>
        <xp:dominoView var="view1" viewName="All"></xp:dominoView>
    </xp:this.data>
    <xp:this.facets>
        <xp:pager partialRefresh="true" layout="Previous Group Next"
            xp:key="headerPager" id="pager1">
        </xp:pager>
    </xp:this.facets>

    <!-- Column 1 -->
    <xp:viewColumn id="viewColumn1"
        columnName="#{javascript:view1.getColumnNames().get(0)}">
        <xp:this.rendered><![CDATA[#{javascript:view1.getColumnCount() > 0}]]></xp:this.rendered>
        <xp:viewColumnHeader id="viewColumnHeader1"
            value="#{javascript:view1.getColumnNames().get(0)}">
        </xp:viewColumnHeader>
    </xp:viewColumn>

    <!-- Column 2 -->
    <xp:viewColumn id="viewColumn2"
        columnName="#{javascript:view1.getColumnNames().get(2)}">
        <xp:this.rendered><![CDATA[#{javascript:view1.getColumnCount() > 1}]]></xp:this.rendered>
        <xp:viewColumnHeader id="viewColumnHeader2"
            value="#{javascript:view1.getColumnNames().get(2)}">
        </xp:viewColumnHeader>
    </xp:viewColumn>

</xp:viewPanel>

</xp:view>

Now you can open the XPage with the URL

http://example.com/yourdb.nsf/view.xsp?viewName=[NAME OF THE VIEW]

Additionally you can add the databaseName parameter to use a view from another db. The other properties can be computed too (categorization, sorting etc.).

2
votes

Consider using repeat controls instead of a view panel. This gives you full flexibility in how you represent the data instead of being constrained to the behavior and assumptions of the view panel. This makes it easier to design a single page that is flexible enough to display any subset of the data.

0
votes

The best solution would be to create 2 services & one page:

  1. Create Service to return view content as JSON (by view properties or agent or web service or xPage, any you fill the best for you)
  2. Create Service to return left menu/list of views as JSON
  3. Create xPage with javascript core that will load data from points 1 and 2 and build UI. jQuery & jQuery UI would help you.

This solution would be flexible and you will grow up you experience