问题
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.
回答1:
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:
Check out these notes in 9 episodes http://notesin9.com/index.php/2012/09/26/notesin9-079-how-to-use-the-xpages-dynamic-view-panel-control/
http://notesin9.com/index.php/2012/10/22/notesin9-083-using-the-xpages-dynamic-view-control-part-2/
回答3:
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.
回答4:
The best solution would be to create 2 services & one page:
- 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)
- Create Service to return left menu/list of views as JSON
- 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
来源:https://stackoverflow.com/questions/13881944/do-i-need-a-separate-xpage-for-each-of-my-30-notes-views