jsf - Primefaces grid was not updated after executing remote command -
this question has answer here:
i have datatable filters on columns , option delete row. when table in intial state, if delete row, table updated. if apply filter, , delete 1 of shown rows, result of filtering remains, until refresh page or change filter.
here code:
<h:form id="form"> <p:datatable id="tdatatable" var="tdata" value="#{oemmodel.models}" widgetvar="oemmodelstable" editable="true" editmode="cell" scrollable="true" scrollheight="500" paginator="true" rows="15" emptymessage="no tdatas found given criteria" filteredvalue="#{oemmodel.filteredoemmodels}"> </p:datatable> <p:dialog id="deletemodeldialog" header="delete " widgetvar="deletedialog" appendto="@(body)" showeffect="fade" hideeffect="fade" height="150" width="350" modal="true" resizable="false" > <h:panelgroup id="deletemodelpanel"> <div align="center"> <h:outputtext value="are sure?" /> <p> <h:panelgrid columns="2"> <p:commandbutton value="yes" icon="ui-icon-check" onclick="pf('waitdialog').show();deletemodel();" /> <p:commandbutton value="no" icon="ui-icon-close" onclick="pf('deletedialog').hide()"/> </h:panelgrid> </p> </div> </h:panelgroup> </p:dialog> <p:remotecommand name="deletemodel" update="tdatatable" actionlistener="#{bbean.deletemodel}" oncomplete="pf('waitdialog').hide();pf('deletedialog').hide();"/> </h:form>
and in backingbean, i'm deleting database, , loading data again:
public void deletemodel() { try { service.deleteoemmodel(selectedmodel.getid()); models= service.getoemmodels(); } ... }
where models binded list.
any hints? have tried change update attribute on remotecommand, update whole form, nothing helps.
you have filter again, because filter cached. described in example ajax update doesn't work, when using filter on p:datatable should try:
<p:remotecommand name="deletemodel" update="tdatatable" actionlistener="#{bbean.deletemodel}" oncomplete="pf('waitdialog').hide();pf('deletedialog').hide(); pf('oemmodelstable').filter()"/>
try pf , without, i'm not primefaces in moment :d
Comments
Post a Comment