0

私はこのコードを持っています:

            <p:contextMenu for="customersTable">  
            <p:menuitem value="Delete" update="customersTable" icon="ui-icon-close" actionListener="#{customerbean.onDeleteCustomer}"/>  
            </p:contextMenu>  


            <p:dataTable id="customersTable" var="customer" widgetVar="customerTable" value="#{customerbean.customerList}" paginator="true" rows="20" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,50,100" emptyMessage="#{text['table.customer.filter.notfound']}" filteredValue="#{customerbean.filteredCustomers}" editable="true" draggableColumns="true" rowKey="#{customer.id}" selection="#{customerbean.selectedCustomer}" selectionMode="single"> 

私の問題は、contextMenuで[削除]をクリックすると、レコード/行がBeanメソッドの呼び出しによってバックエンドから消去されているという意味ですべてが正常に機能しているが、新しいデータを反映してテーブルが更新されていないことです。 。

4

2 に答える 2

1

更新中に dataTable の完全なコンポーネント ID を提供する必要があります。

 <h:form id="frm">
  <p:contextMenu for="customersTable">  
        <p:menuitem value="Delete" update="frm:customersTable" icon="ui-icon-close"  actionListener="#{customerbean.onDeleteCustomer}"/>  
        </p:contextMenu>  
        <p:dataTable id="customersTable" var="customer" widgetVar="customerTable"         value="#{customerbean.customerList}" paginator="true" rows="20" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,50,100" emptyMessage="#{text['table.customer.filter.notfound']}" filteredValue="#{customerbean.filteredCustomers}" editable="true" draggableColumns="true" rowKey="#{customer.id}" selection="#{customerbean.selectedCustomer}" selectionMode="single"> 



 </h:form>
于 2012-09-17T10:55:36.023 に答える
0

わかりました、私は問題が何であるかを見つけました - 非常に些細なことです。データベースからは削除していましたが、Primefaces が画面にレンダリングするために使用するコレクションからは削除していませんでした。両方から削除する必要があります。

于 2012-09-18T05:35:42.790 に答える