开发者

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 certai开发者_如何学Pythonn property (e. g. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜