使用动态视图面板 [英] Using a Dynamic View Panel
问题描述
我正在使用动态视图面板在单个 XPage 中显示各种视图.这导致了一些问题.首先,在视图内部设置的列样式不会显示在XPage上(例如:使列标题变为粗体).更重要的是,尽管该视图包含指向该视图内文档的链接,但所有链接都都附加了action=editDocument
,我想将其更改为action=openDocument
.但是,我找不到任何更改此属性的方法.
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.
推荐答案
您需要为此使用定制器bean,并将该bean的名称添加到Dynamic View Panel控件的customizerBean
属性中.
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.
在定制器Bean中,您可以控制样式(例如您要查找的样式),但是您需要自己编写Java Bean.杰西·加拉格尔(Jesse Gallagher)创建了扩展定制器bean的绝佳示例,甚至将其放在Github上: https: //github.com/jesse-gallagher/Domino-One-Offs .
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
-
对于将editDocument更改为openDocument的具体问题,可以使用以下定制器bean的小示例:
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);
}
}
请记住将类添加到faces-config.xml,以便能够将其用作bean.
Remember to add the class to faces-config.xml in order to be able to use it as a bean.
您可以使用onColumnClick事件代替定制程序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>
这篇关于使用动态视图面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!