Using a Dynamic View Panel

lotus-notes, xpages

Solution

You need to use a customizer bean for this and add the name of that bean to the `customizerBean` property of the Dynamic View Panel control.

In the customizer bean you can control styling such as what you are looking for but you need to code the Java bean yourself. Jesse Gallagher has created a great example of an extended customizer bean and even put it on Github: https://github.com/jesse-gallagher/Domino-One-Offs.

Have a look at his blog posts on the subject:

- This Dynamic View Customizer Is Getting Into Shape

- Enhancing xe:dynamicViewPanel For My Own Purposes

--

For your specific question on changing editDocument to openDocument you can use the following small example of a customizer bean:

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import com.ibm.xsp.extlib.builder.ControlBuilder.IControl;
import com.ibm.xsp.extlib.component.dynamicview.DominoDynamicColumnBuilder.DominoViewCustomizer;
import com.ibm.xsp.extlib.component.dynamicview.UIDynamicViewPanel.DynamicColumn;
import com.ibm.xsp.extlib.component.dynamicview.ViewDesign.ColumnDef;

public class customizer extends DominoViewCustomizer{
  @Override
  public void afterCreateColumn(FacesContext context, int index, ColumnDef colDef, IControl column) {
    //Create a variable for the current component
    UIComponent columnComponent = column.getComponent();
    //Create a reference to the column and set the links to open in read mode
    DynamicColumn dynamicColumn = (DynamicColumn) columnComponent;
    dynamicColumn.setOpenDocAsReadonly(true);
    super.afterCreateColumn(context, index, colDef, column);
  }
}

Remember to add the class to faces-config.xml in order to be able to use it as a bean.

Instead of a customizer bean you can use the onColumnClick event to do your own redirect. Here's an example:

<xe:dynamicViewPanel value="#{viewdatasource}" id="dynamicViewPanel1" var="viewEntry" pageName="/page.xsp">     
    <xp:eventHandler event="onColumnClick" submit="true" refreshMode="complete">
        <xp:this.action><![CDATA[#{javascript:var url="/page.xsp?action=openDocument&documentId="+viewEntry.getNoteID();
context.redirectToPage(url);
}]]></xp:this.action>
    </xp:eventHandler>
</xe:dynamicViewPanel>

Problem

I am using a Dynamic View Panel to display various views inside a single XPage. This has resulted in a few problems. Firstly, column styling set inside the views is not displayed on the XPage (eg: making column headers bold). More importantly, while the view contains links to the documents inside the view, links are all appended with `action=editDocument`, which I would like to change to `action=openDocument`. However, I cannot find any way to change this property.

Original source