admin管理员组文章数量:1434922
I want to get p:selectBooleanCheckbox
ponent and check if it is selected or not using javascript
<h:dataTable value="#{controller.list}" var="item">
<h:column>
<f:facet name="header">Ratio1</f:facet>
<h:panelGrid columns="2">
<p:inputText id="ratio1" readonly="#{true}" disabled="true" styleClass="ratio1"/>
<h:outputText value="%" />
</h:panelGrid>
<p:selectBooleanCheckbox id="report1" onchange="calculateTotalRatio()" value="#{controller.value}" valueChangeListener="#{fISHController.onCaseTestItemPatternReportFlagChange()}">
</p:selectBooleanCheckbox>
</h:column>
I want on calculateTotalRatio()
function check if the checkbox is checked or not and depending on it update ratio1 input text with value
I want to get p:selectBooleanCheckbox
ponent and check if it is selected or not using javascript
<h:dataTable value="#{controller.list}" var="item">
<h:column>
<f:facet name="header">Ratio1</f:facet>
<h:panelGrid columns="2">
<p:inputText id="ratio1" readonly="#{true}" disabled="true" styleClass="ratio1"/>
<h:outputText value="%" />
</h:panelGrid>
<p:selectBooleanCheckbox id="report1" onchange="calculateTotalRatio()" value="#{controller.value}" valueChangeListener="#{fISHController.onCaseTestItemPatternReportFlagChange()}">
</p:selectBooleanCheckbox>
</h:column>
I want on calculateTotalRatio()
function check if the checkbox is checked or not and depending on it update ratio1 input text with value
- Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. – Zakaria Acharki Commented Jul 21, 2016 at 14:29
- Look this answer stackoverflow./a/11441530/6065134 – Artem Commented Jul 21, 2016 at 15:06
- @ZakariaAcharki i added sample of my code, sorry i still beginner in stackoverflow – Raied Raafat Commented Jul 27, 2016 at 8:33
1 Answer
Reset to default 4You can define the widgetVar of your selectBooleanCheckbox
<p:selectBooleanCheckbox id="check" widgetVar="myCheckbox" value="#{myBacking.value}"/>
You can access in js the Primefaces object in these ways
directly with myCheckbox
PF("myCheckbox")
window["myCheckbox"]
PrimeFaces.widgets["myCheckbox"]
So, to get the checkbox state you can use
myCheckbox.input.is(':checked')
PF("myCheckbox").input.is(':checked')
window["myCheckbox"].input.is(':checked')
PrimeFaces.widgets["myCheckbox"].input.is(':checked')
版权声明:本文标题:html - How to know that primefaces selectBooleanCheckbox is selected or not using javascript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745630124a2667219.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论