RICH:dataTable - 删除行后刷新页面

时间:2011-05-18 06:33:57

标签: java jsf richfaces

我有删除按钮的丰富数据表:

enter image description here

当我删除行时,行确实在数据库中被删除,但仍保留在dataTable中。重载页面或重新加载dataTable后消失。

dataTable代码的一部分:

<rich:extendedDataTable 
  value="#{myBdeCheck.dataListBde}"
  var="bdeItem">

 <rich:column width="60px">
  <f:facet name="header">
     <h:outputText value="Kusy" />
  </f:facet>
  <h:outputText value="#{bdeItem.prodPcs}" rendered="#{!myBdeCheck.editMode}"/>
  <h:inputText value="#{bdeItem.prodPcs}" rendered="#{myBdeCheck.editMode}"/>
 </rich:column>

 <rich:column width="50px">
  <h:commandLink action="#{myBdeCheck.deleteBde}">
    <h:graphicImage value="/images/icons/delete.png" alt="edit"/>
    <a4j:param value="#{it.index}" assignTo="#{myBdeCheck.currentIndexDetail}" />
    <f:setPropertyActionListener target="#{myBdeCheck.BDEItem}" value="#{bdeItem}" />
  </h:commandLink>
 </rich:column>
</rich:extendedDataTable>

和myBdeCheck bean的一部分:

private int currentIndexDetail; // with getters, setters
private BDE BDEItem;

public void deleteBde()
{
  try 
  { 
    DaoCrud.delete(BDEItem, 'R');
  } 
  catch{.....}
}

如何在点击删除按钮后自动刷新dataTable?

2 个答案:

答案 0 :(得分:2)

执行操作后,您需要rerender数据表

<h:commandLink action="#{myBdeCheck.deleteBde}" reRender="idOfYourDataTable">

检查this以获取更多信息..

答案 1 :(得分:1)

删除后需要reRender表。

<rich:extendedDataTable 
  value="#{myBdeCheck.dataListBde}"
  var="bdeItem" id="myTable">

<h:commandLink action="#{myBdeCheck.deleteBde}" reRender="myTable">