简体   繁体   English

h:selectmanyCheckbox超过1行

[英]More than 1 row with h:selectmanyCheckbox

I have a list of 16 items which should be shown like this 我有16个项目的清单,应该这样显示

1 2 3 4
5 6 7 8
etc.

4 Items in a row and then it should add another row. 连续4个项目,然后应添加另一行。

My problem is that your only allowed to show the info like 我的问题是您只允许显示以下信息

1 2 3 4 5 6 7 8 9 10 etc

or 要么

1
2
3
4
etc.

My code looks like this: 我的代码如下所示:

<h:selectManyCheckbox value="#{main.selectedStates}">
  <f:selectItems value="#{main.stateOutput}" />
</h:selectManyCheckbox>

I have absolutely no idea how this should work. 我完全不知道这应该如何工作。 I spent now like 2 hours searching it on Google. 我现在花了大约2个小时在Google上搜索它。

PS: Please don't blame me for my english :P PS:请不要怪我的英语:P

A non intrusive solution would be to use some JavaScript to modify the HTML DOM after the DOM tree has loaded. 一种非侵入性的解决方案是在DOM树加载后使用一些JavaScript来修改HTML DOM。 Something like, pseudo-code: 伪代码之类的东西:

someSelectorForCheckboxDiv.forEach( if ... then ...set css or insert dom element );

The other way has been suggested by Luiggi and is probably closer to the JSF spirit. Luiggi提出了另一种方法,可能更接近JSF精神。

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

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