简体   繁体   English

是否有JSF切换组件或以h:selectBooleanCheckbox为主题设置图像的方法?

[英]Is there a JSF toggle component or a way to theme an h:selectBooleanCheckbox with images?

I tried using a toggle like below. 我尝试使用下面的切换。 Although it works, it breaks when used inside of a composite component - changing the singleSelect value outside of the component never updates inside the component: 虽然有效,但在复合组件内部使用时会中断-在组件外部更改singleSelect值永远不会在组件内部更新:

<h:commandButton disabled="#{cc.attrs.singleSelect}"
                 image="/resources/img/collapse-single.gif">
    <f:ajax listener="#{cc.toggleSingleSelect}" render="#{cc.clientId}"/>
</h:commandButton>

<h:commandButton disabled="#{! cc.attrs.singleSelect}"
                 image="/resources/img/expand-single.gif">
    <f:ajax listener="#{cc.toggleSingleSelect}" render="#{cc.clientId}"/>
</h:commandButton>

But if I use a simple checkbox, it works fine: 但是,如果我使用简单的复选框,则可以正常工作:

<h:selectBooleanCheckbox value="#{cc.attrs.singleSelect}">
    <f:ajax render="#{cc.clientId}"/>
</h:selectBooleanCheckbox >

Is there something that behaves like a checkbox, but uses images? 是否有某些行为类似于复选框但使用图像?

I've decided to go with an ICEfaces solution and use their ace:checkboxButton: 我决定使用ICEfaces解决方案,并使用其ace:checkboxButton:

<ace:checkboxButton value="#{cc.attrs.singleSelect}" styleClass="toggle">
    <ace:ajax render="#{cc.clientId}"/>
</ace:checkboxButton>

You are able to style it to use images: 您可以设置其样式以使用图像:

http://icefaces-showcase.icesoft.org/showcase.jsf?grp=aceMenu&exp=checkboxButtonCustom http://icefaces-showcase.icesoft.org/showcase.jsf?grp=aceMenu&exp=checkboxButtonCustom

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM