Render selectManyCheckbox without HTML table

。_饼干妹妹 提交于 2020-01-11 06:51:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!