jsf - primefaces how to update datatable -
how can update datatable in primefaces.datatable updates when refresh page. have found solutions none of them worked me.for example when change update ":companyform:companypanel" save button disappers. removed colon , can see button still doesn't update datatable. here jsf page;
<h:form id="companyform" prependid="false"> <p:panel id="companypanel"> <p:datatable id="companylisttable"> //columns </p:datatable> </p:panel> <p:outputpanel id="newdatepanel"> <p:commandbutton value="save" update="companyform:companypanel companyform:newdatepanel" action="#{mycontroller.save()}"/> </p:outputpanel> </form>
and spring controller;
init(){ companylist = service.getallcompany(); } public void save(){ service.save(company); }
actually have ids messed up, otherwise components have been refreshed.
the actual client id of component depends on naming container tag's in. in case, naming container <h:form>
. included prependid="false"
property in form tag client id of nested <p:panel id="companypanel">
companypanel
, otherwise (if omitted prependid
altogether) - companyform:companypanel
.
still, want update component within same naming container (form), don't need prefix form id , let <p:commandbutton update="companypanel">
: without colon , without form id, there any.
in state code now, there no component id companyform:companypanel
.