ajax - How to submit JSF PrimeFaces form with selectBooleanCheckbox without refreshing the page? -
i'm using jsf primefaces make application assignment college. i'm struggling working. i'm using primefaces , have tabview contains 5 tabs. in 1 of tabs have datatable has several rows , columns. works fine, problem want submit form without rerendering (entire page). thing is, every column in datatable has selectbooleancheckbox, , when checkbox selected, button should disappear. if it's unselected button should appear. works fine onchange="this.form.submit()" or onclick="this.form.submit()" refreshes entire application, , causes first tab selected, rather 1 at. i'm looking solution able submit , re-render stuff without refreshing entire program. code:
<body> <h:form id="customerform"> <p:datatable id="customerlist" var="c" value="#{customerbean.customerlist}"> <p:column> <f:facet name="header">select</f:facet> <center> <p:selectbooleancheckbox value="#{c.selected}" onchange="this.form.submit()"/> </center> </p:column> </p:datatable> <h:commandbutton id="testtest" value="test" rendered="#{customerbean.numberselected() == 0}"/> </h:form> </body>
i removed of columns sake of simplicity. solution this? i've tried using ajax, didn't work
<p:selectbooleancheckbox value="#{c.selected}"> <f:ajax event="click" execute="@form" render="@none"/> </p:selectbooleancheckbox>
do need submit whole form? if it's enough view being rerenderd try update form. can use primefaces ajax event.
<p:selectbooleancheckbox value="#{c.selected}"> <p:ajax update="@form"/> </p:selectbooleancheckbox>
if not work, please tell "..ajax, didn't work" mean. there post request submitted? action/setter called?
Comments
Post a Comment