Reputation: 3320
I want to render the same button that execute the ajax call
<p:commandButton id="load"
actionListener="#{bean.Valid}"
rendered="#{bean.renderButton}"
value="Load Object"
ajax="true"
update="load,group,ip1">
</p:commandButton>
I try to do that via the p:commanButton update and also via RequestContext.getCurrentInstance() in the bean but both of them are not working
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.update("mainForm:load");
Any advice what I am missing here ?
Thanks
Upvotes: 0
Views: 1580
Reputation: 8771
You need to wrap your button inside something, example :
<h:panelGroup id="button-wrapper">
<p:commandButton id="load"
actionListener="#{bean.Valid}"
rendered="#{bean.renderButton}"
value="Load Object"
ajax="true"
update="button-wrapper,group,ip1">
</p:commandButton>
</h:panelGroup>
Ortherwise, your button won't be able to update an element that isn't rendered anymore in the components tree.
Upvotes: 2