0

I have two Portlets: the first contains: datatable A and the second: datatable B. The two portlets are shown in the same page. I want to refresh the datatable A after I click on a command button in the datatable B.

The method called by the command button contains this code:

OnDemandRenderer onDemandRenderer = getRenderManager().getOnDemandRenderer("RENDER_GROUP");
onDemandRenderer.requestRender();

But it doesn't work. Can anyone help me please? Some hints? Thanks in advance for any help!!

4

1 回答 1

0

我使用静态变量解决了这个问题。Datatable A 使用在托管 bean 中以这种方式填充的 dataModel 对象:

dataModel=new ListDataModel(globalDD.getDetailsList());

其中托管 bean 中的 globalDD:

private GlobalDocumentDetails globalDD;
public GlobalDocumentDetails getGlobalDD() {
  return SessionBeanUtility.getGlobalDD();
}
public void setGlobalDD(GlobalDocumentDetails globalDD) {
  this.globalDD = globalDD;
}

而 SessionBeanUtility.getGlobalDD() 是

public static GlobalDocumentDetails getGlobalDD(){
    if (FacesUtil.getPortletSession().getAttribute(GLOBAL_DD_BEAN_KA, PortletSession.APPLICATION_SCOPE) == null)
    {
        new GlobalDocumentDetails();
        FacesUtil.getPortletSession().setAttribute(GLOBAL_DD_BEAN_KA, new GlobalDocumentDetails(), PortletSession.APPLICATION_SCOPE);
    }
    return (GlobalDocumentDetails)FacesUtil.getPortletSession().getAttribute(GLOBAL_DD_BEAN_KA, PortletSession.APPLICATION_SCOPE);
}

数据表 B 包含购物车的项目,购物车是一个静态对象。我在两个数据表的 actionListeners 方法中使用我在问题中编写的代码来刷新两者。

于 2013-03-25T15:35:06.520 回答