This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 8, 2011, 7:20 AM
41 Posts

Re: viewPanel, expandLevel and buttons

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 3
 One easy way to do this is to call the method directly against the data source during an event (i.e. button or link):
 
getComponent("viewPanelId").getDataModel().getDominoViewData().setExpandLevel(0); // 0 for collapse, 1 for expand
 
If the view data source is global to the page (or to a panel containing the event handler), not local to the view panel, you can skip all the chaining above and just refer directly to the var of the data source:
 
myView.setExpandLevel(0); // where <xp:dominoView var="myView" /> 
Mar 8, 2011, 5:00 PM
14 Posts
couldn't make it work
Tim,
 
Thanks for your reply. I believe your first method is appropriate for my situation, but I could not get it to work. I am probably doing something incorrectly, let me see if I can recap what I did.

I have one xpage with just a viewpanel and 2 buttons. The view panel has an id of viewPanel1 so in the expand button I have SSJS with the formula
getComponent("viewPanel1").getDataModel().getDominoViewData().setExpandLevel(1)
 
I created a collapse button with the SSJS getComponent("viewPanel1").getDataModel().getDominoViewData().setExpandLevel(0)
 
For both buttons, I first tried a Full Update, but when I previewed the xpage in a web browser and clicked the button, it would reload the page, but the view would stay the same. Next,  I changed the button to Partial Update and selected  viewPanel1 as my design element. When I reloaded the page, it refreshed just the view panel, but again the view did not change at all. It remained collapsed. Finally, I removed the setting in expandLevel property for the viewpanel. I thought maybe that was interfering. Next, when I viewed the xpage, the view was automatically expanded, but the buttons still had no effect.
 
The view is standard notes view with 2 categorized columns. The docs in the view are protected by readers field, but I am authenticated and can see all the docs.
 
When viewing the Xpage in the browser, I can click and open the different categories in the view without any problems. Any ideas what I might be doing wrong. I know I should create custom controls for the buttons and a separate one for the view, but I am new to XPages and just trying to keep it simple for now.
Mar 10, 2011, 6:30 PM
14 Posts
this solution worked
Not sure why this worked and the other solution that Tim suggested did not.. Any insight would be helpful, thanks
 
collapse link
var viewPanel = getComponent("viewPanel1");
var model:com.ibm.xsp.model.domino.DominoViewDataModel = viewPanel.getDataModel();
var container:com.ibm.xsp.model.domino.DominoViewDataContainer = model.getDominoViewDataContainer();
container.collapseAll();
 
expand link
var viewPanel = getComponent("viewPanel1");
var model:com.ibm.xsp.model.domino.DominoViewDataModel = viewPanel.getDataModel();
var container:com.ibm.xsp.model.domino.DominoViewDataContainer = model.getDominoViewDataContainer();
container.expandAll();

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal