问题
is there a way to remove the table out of rendered html that is created by the h:selectManyCheckbox
tag in server faces?
I am using twitter bootstrap and i placed the checkboxes inside a dropdown menu:
<ul class="dropdown-menu dropdown-menu-form">
<li><label class="checkbox"> <input type="checkbox" />
Activated
</label></li>
<li><label class="checkbox"> <input type="checkbox" />
Deactivated
</label></li>
</ul>
So the generated html table destroys the layout ...
回答1:
You could just render a bunch of <h:outputLabel><h:selectBooleanCheckbox>
inside <ui:repeat>
. This way you've markup freedom. You'll only need to alter the model from e.g. List<T>
to Map<T, Boolean>
to represent the checked values and then loop over the map afterwards to collect checked ones.
A ready-to-use component is Tomahawk's <t:selectManyCheckbox> which has an additional layout
attribute value of spread
.
来源:https://stackoverflow.com/questions/21607967/render-selectmanycheckbox-without-html-table