Using a Dynamic View Panel

心已入冬 提交于 2019-12-04 11:52:01

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:

--

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>
Ashwini Kurakuri

If you want to open document using its form instead of using XPage, then you can do it like this, where rowData is var for ViewPanel

<xp:eventHandler event="onColumnClick" submit="true" refreshMode="complete" id="eventHandler1">
    <xp:this.action><![CDATA[#{javascript:if (!rowData.isCategory())
        var url = "0/"+rowData.getUniversalID()+"?OpenDocument"
        facesContext.getExternalContext().redirect(url);}]]>
    </xp:this.action>
</xp:eventHandler

In SSJS, you can possibly try on the links in the document by adding this:

context.redirectToPage(@ReplaceSubstring(context.getUrl().toString(),"editDocument","openDocument"));

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!