选择复选框数据表 primefaces 上的行选择
我们需要在复选框切换的行选择上触发 ajax 事件..i 试图找到示例,但他们只在单击时进行行选择 p:命令按钮。我们使用的是primefaces 2.2
代码
<p:dataTable id="insList" var="insured"
value="#{policyHandler.insuredList}" paginator="true"
rows="#{label.insuredList_defaultNumberOfRows}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="#{label.insuredList_numberOfRows}"
style="width: 98%;" selection="#{policyHandler.inquiryInsureds}"> <!--<p:column>
<f:facet name="header">
<h:outputLabel value="Select" />
</f:facet>
<h:selectBooleanCheckbox id="selection"
value="#{insured.status}">
<p:ajax event="click" update="insuredOrder, selection" />
</h:selectBooleanCheckbox>
</p:column>
-->
<p:column selectionMode="multiple" />
<p:column>
<f:facet name="header">
<h:outputLabel value="Sequence" />
</f:facet>
<p:cellEditor id="insuredOrder" disabled="#{!insured.status}">
<f:facet name="output">
<h:outputText value="#{insured.sequence}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{insured.sequence}" />
</f:facet>
</p:cellEditor>
<p:rowEditor />
</p:column>
<p:column headerText="Name"
sortBy="#{insured.generalPartyInfo.nameInfo.commlName.commercialName}"
filterMatchMode="contains" style="text-align:center;">
<h:outputText
value="#{insured.generalPartyInfo.nameInfo.commlName.commercialName}" />
</p:column>
<p:column sortBy="#{insured.generalPartyInfo.addr.city}"
style="text-align:center;">
<f:facet name="header">
<h:outputLabel value="Street Address" />
</f:facet>
<h:outputText value="#{insured.generalPartyInfo.addr.city}" />
</p:column>
<p:column sortBy="#{insured.generalPartyInfo.addr.city}"
style="text-align:center;" width="10%">
<f:facet name="header">
<h:outputLabel value="#{label.city}, #{label.state} " />
<h:outputLabel value=" #{label.postalcode}" />
</f:facet>
<h:outputText
value="#{insured.generalPartyInfo.addr.city}, #{insured.generalPartyInfo.addr.stateProv} #{insured.generalPartyInfo.addr.postalCode}" />
</p:column>
<p:column headerText="Policy Type">
<h:outputText value="#{insured.policyType}" />
</p:column>
<p:column headerText="Action" style="text-align:center;">
<p:commandLink>
<h:outputText value="Change" />
</p:commandLink>
</p:column>
</p:dataTable>
we need to fire ajax event on row selection on toggle of checkbox..i
tried to find example but they are only doing row selection on click
of p:command button.we are using primefaces 2.2
Code
<p:dataTable id="insList" var="insured"
value="#{policyHandler.insuredList}" paginator="true"
rows="#{label.insuredList_defaultNumberOfRows}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="#{label.insuredList_numberOfRows}"
style="width: 98%;" selection="#{policyHandler.inquiryInsureds}"> <!--<p:column>
<f:facet name="header">
<h:outputLabel value="Select" />
</f:facet>
<h:selectBooleanCheckbox id="selection"
value="#{insured.status}">
<p:ajax event="click" update="insuredOrder, selection" />
</h:selectBooleanCheckbox>
</p:column>
-->
<p:column selectionMode="multiple" />
<p:column>
<f:facet name="header">
<h:outputLabel value="Sequence" />
</f:facet>
<p:cellEditor id="insuredOrder" disabled="#{!insured.status}">
<f:facet name="output">
<h:outputText value="#{insured.sequence}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{insured.sequence}" />
</f:facet>
</p:cellEditor>
<p:rowEditor />
</p:column>
<p:column headerText="Name"
sortBy="#{insured.generalPartyInfo.nameInfo.commlName.commercialName}"
filterMatchMode="contains" style="text-align:center;">
<h:outputText
value="#{insured.generalPartyInfo.nameInfo.commlName.commercialName}" />
</p:column>
<p:column sortBy="#{insured.generalPartyInfo.addr.city}"
style="text-align:center;">
<f:facet name="header">
<h:outputLabel value="Street Address" />
</f:facet>
<h:outputText value="#{insured.generalPartyInfo.addr.city}" />
</p:column>
<p:column sortBy="#{insured.generalPartyInfo.addr.city}"
style="text-align:center;" width="10%">
<f:facet name="header">
<h:outputLabel value="#{label.city}, #{label.state} " />
<h:outputLabel value=" #{label.postalcode}" />
</f:facet>
<h:outputText
value="#{insured.generalPartyInfo.addr.city}, #{insured.generalPartyInfo.addr.stateProv} #{insured.generalPartyInfo.addr.postalCode}" />
</p:column>
<p:column headerText="Policy Type">
<h:outputText value="#{insured.policyType}" />
</p:column>
<p:column headerText="Action" style="text-align:center;">
<p:commandLink>
<h:outputText value="Change" />
</p:commandLink>
</p:column>
</p:dataTable>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)