[英]Set p:selectBooleanCheckbox value to bean with ajax
Hi i have a primefaces datatable with dynamic columns 嗨,我有一个带有动态列的primefaces数据表
<h:form>
<p:dataTable id="cars" var="car" value="#{formBean.carsSmall}"
filteredValue="#{formBean.filteredCars}">
<p:columns value="#{formBean.columns}" var="column"
columnIndexVar="colIndex"sortBy="#{column.property}"
filterBy="#{column.property}">
<f:facet name="header">
#{column.header}
</f:facet>
<p:outputPanel
rendered="#{(column.header eq 'CHECKVALUE1') or (column.header eq 'CHECKVALUE2')}" >
<p:selectBooleanCheckbox value="#{car.checkValue}" id="checkboxId">
</p:selectBooleanCheckbox>
</p:outputPanel>
<p:outputPanel
rendered="#{(column.header ne 'CHECKVALUE1') and (column.header ne 'CHECKVALUE2')}" >
#{car[column.property]}
</p:outputPanel>
</p:columns>
</p:dataTable>
</h:form>
and i want to submit checkbox values to bean with ajax how could i do that ?? 而且我想使用ajax将复选框值提交给bean,我该怎么做? I tried to write something like:
我试图写类似:
<p:selectBooleanCheckbox value="#{car.checkValue}" id="checkboxId">
<p:ajax update="@form"/>
</p:selectBooleanCheckbox>
But the value doesnt set to bean.. 但是该值未设置为bean。
<p:selectBooleanCheckbox value="#{car.checkValue}" id="checkboxId">
<p:ajax update=":form" listener="#{car.addMessage}"/>
</p:selectBooleanCheckbox>
Java Bean Class - Java Bean类-
public void addMessage()
{
//Your Java Code goes here.
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.