Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faces 4.0: add f:selectItemGroups #1559

Closed
BalusC opened this issue Feb 25, 2021 · 8 comments
Closed

Faces 4.0: add f:selectItemGroups #1559

BalusC opened this issue Feb 25, 2021 · 8 comments
Milestone

Comments

@BalusC
Copy link
Member

BalusC commented Feb 25, 2021

There's currently no way to declare SelectItemGroup via the view. These have to be manually created in the model.

Proposal: introduce <f:selectItemGroups>

<h:selectOneMenu value="#{bean.selectedProduct}">
    <f:selectItem itemValue="#{null}" />
    <f:selectItemGroups value="#{bean.categories}" var="category" itemLabel="#{category.name}">
        <f:selectItems value="#{category.products}" var="product" itemLabel="#{product.name}" />
    </f:selectItemGroups>
</h:selectOneMenu>

Example implementation: https://showcase.omnifaces.org/components/selectItemGroups

While at it, SelectItemGroup#setSelectItems() currently only accepts a SelectItem[] (pre Java 1.5 approach). Improve it to accept varargs and/or a Collection.

@tandraschko
Copy link

+1

@arjantijms arjantijms added the 4.0 label Mar 27, 2021
@arjantijms arjantijms added this to the 4.0 milestone Mar 27, 2021
BalusC added a commit to eclipse-ee4j/mojarra that referenced this issue Mar 27, 2021
BalusC added a commit to eclipse-ee4j/mojarra that referenced this issue Mar 27, 2021
BalusC added a commit to eclipse-ee4j/mojarra that referenced this issue Mar 27, 2021
BalusC added a commit to eclipse-ee4j/mojarra that referenced this issue Mar 27, 2021
BalusC added a commit to eclipse-ee4j/mojarra that referenced this issue Mar 27, 2021
BalusC added a commit to eclipse-ee4j/mojarra that referenced this issue Mar 27, 2021
@BalusC
Copy link
Member Author

BalusC commented Mar 27, 2021

It's now in Faces 4.0, along with an IT 👍

@BalusC BalusC closed this as completed Mar 27, 2021
@tandraschko
Copy link

tandraschko commented Mar 27, 2021

@BalusC i currently implement this feature in MyFaces and im not sure if selectItemGroups should inherit from selectItems
i would like to implement it without, it feels a bit hacky - at least how its implemented in Mojarra to wrap getValue.

I think i could also implement with inheritance but without that #getValue overload, we dont have to be backward compatible i think.

@tandraschko
Copy link

also i wonder if we shoudlnt add f:selectItemGroup, too?

@BalusC
Copy link
Member Author

BalusC commented Mar 27, 2021

Existing UISelectOne/UISelectMany components only support UISelectItems/UISelectItem children. Hence UISelectItemGroups really has to extend from one of these. As the value attribute is an array/iterable, it has to be UISelectItems.

f:selectItemGroup isn't terribly useful, but I think you're right, that it should be added too.

@tandraschko
Copy link

yep, or change UISelectOne/Many renderers. Not sure whats better.

Would you like to create a ticket + impl in Mojarra for f:selectItemGroup? I will continue with MyFaces then.

@BalusC
Copy link
Member Author

BalusC commented Mar 27, 2021

Changing renderers completely breaks backwards compatibility on component libraries.

I'll add ticket.

@BalusC
Copy link
Member Author

BalusC commented Mar 28, 2021

Reopening; itemLabel and itemDisabled attributes are missing in taglib documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants