简体   繁体   中英

JSF: More customizable selectManyCheckbox and selectOneRadio

I'm using selectManyCheckboxes and selectOneRadios and I would like to customize them in some way. It would be sufficient if there was be a possibilty to group the selectItems according to a certain property (eg with a headline for each group or a line between each group).

Is there any way to achieve this with standard JSF 2 + Tomahawk?

Yes, certainly this is possible. You've already made a good choice with Tomahawk. It's namely one of the very few component libraries which provides components which allows you to position checkboxes and radiobuttons everywhere the way you want instead of ending up with them in a table as the standard components do.

Here's a kickoff example with <t:selectOneRadio> (note the new layout="spread" attribute, the JSF defaults are pageDirection and lineDirection ) and <t:radio> .

<t:selectOneRadio id="foo" value="#{bean.selectedItem}" layout="spread">
    <f:selectItems value="#{bean.selectItems}" />
</t:selectOneRadio>

<p><t:radio for="foo" index="0" /> radio in paragraph</p>
<h1><t:radio for="foo" index="1" /> radio in heading</h1>
<hr />
<p><t:radio for="foo" index="2" /> radio after horizontal rule</p>

The <t:selectManyCheckbox> also supports layout="spread" with <t:checkbox> the same way.

This allows for more fine grained HTML/CSS markup on and around those buttons/checkboxes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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