0

I have a list of 16 items which should be shown like this

1 2 3 4
5 6 7 8
etc.

4 Items in a row and then it should add another row.

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.

PS: Please don't blame me for my english :P

Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
  • 1
    There is no native JSF component that will support what you want. However, you can make your own look 'n feel using `` and `` tag components. – Luiggi Mendoza Jan 29 '13 at 16:06
  • 1
    Similar questions http://stackoverflow.com/questions/11255509/how-to-custom-layout-hselectoneradio and http://stackoverflow.com/questions/1150717/breaking-up-radio-buttons-into-columns-in-jsf/1152921 but for radios – Ravi Kadaboina Jan 29 '13 at 16:51
  • I solved it by making 4 lists and display them vertically – Samuel Brand Feb 02 '13 at 10:50

1 Answers1

0

A non intrusive solution would be to use some JavaScript to modify the HTML DOM after the DOM tree has loaded. 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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Christophe Roussy
  • 16,299
  • 4
  • 85
  • 85
  • I though this as a possible answer too but I don't have an IDE in my workplace to make the tests =\ (well, I have an IDE but I can't use the work laptop for that =\). – Luiggi Mendoza Jan 29 '13 at 16:26