0

I have a fieldset to witch I add components dynamically code looks like this:

<fieldset>
            <legend style="color:blue;font-weight:bold;">#{msgs.newsletterConstantPersonalization}</legend>
            <ui:repeat var="personalizedProp" value="#{newsletterWflBean.constantPersonalizationProperties}">
                <comp:embeddedLabel label="#{personalizedProp.name}">
                    <h:selectBooleanCheckbox value="#{personalizedProp.used}" />
                </comp:embeddedLabel>
            </ui:repeat>
        </fieldset>

However every component appear beneath previews one. I would like to create fix amount of columns eg. 3 and place new components side by side.

So, now it looks like this:

comp1
comp2
comp3
...
compx

What I want for eg. 3 columns:

comp1 comp2 comp3
comp4 comp5 comp6
...
compx compx+1 ...

(where comp is label+checkbox)

How can I achieve that with JSF? I don't want to create a list of lists and duplicate ui:repeat tag. I wan't to keep view separate from business logic. So I would like everything to be done in JSF/JavaScript.

Also with legend tag I assume (http://www.w3schools.com/tags/tag_legend.asp) I should have nice title border around my components but that doesn't work. Why? How to create title border/legend using JSF?

Thanks for help

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
MAREK
  • 173
  • 1
  • 1
  • 7
  • Thanks @BalusC dataGrid was exactly what I was looking for. However I still can't manage to create titled border/legend around my dataGrid. Why legend tag doesn't work like in case of plain HTML? – MAREK Jun 30 '16 at 09:16
  • http://htmldog.com/references/html/tags/legend *"The element should appear directly after the opening fieldset tag."*. The dataGrid component doesn't generate a fieldset tag. Use another tag to represent a legend, e.g. h2/h3/h4. This has not much to do with JSF. – BalusC Jun 30 '16 at 09:19
  • In my generated HTML tag actually appears right after
    tag. It looks like this:
    Constant Personalization ...[STUFF GENERATED FROM dataGrid]
    . So I wander if legend tag doesn't work with some other HTML tags? Not only border is missing but even "Constant Personalization" text is not rendered.
    – MAREK Jun 30 '16 at 10:03
  • Ok, now I understand that the border comes from styling fieldset element rather than from legend element. It actually make more sense. Moreover, in the project I took over legend element was styled to not display at all. Charms of being a newbie in a big project :). Anyway, @BalusC thank you for your help and sorry about confusion around this topic. – MAREK Jun 30 '16 at 15:00

0 Answers0