-
Notifications
You must be signed in to change notification settings - Fork 273
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
feat(ui5-filter-item, ui5-sort-item,..): add selected filterItems
to ui5-confirm
event details
#9838
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @hinzzx ,
Adding itemKey
property to items is a part of the whole task, other part is to return whole items as confirm event detail so developer can distinguish selected filter items/options by their key. Now the event parameter still contains only text values.
Also, in the provided sample there's no idea what happens when the VSD is closed.
Best Regards,
Nikolay Hristov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, it seems redundant to have first selected filters with all their options inside (no matter selected or not, but there is property for this), and second - the same list of just selected options. If there is no (easy) way to list just selected filter item (without its options), the second (selected options list) is maybe pointless.
Edit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that needs to be done is to add one line that returns the item
in addition to the itemText
{
itemText: item.text,
item,
}
Тhis is enough for the application. They can set their own properties on the items to differentiate them, as long as we return the item instead of its text, so they have the reference.
In UI5 Web Components we do not create properties that are not used for the rendering and only serve to help the application, because this is HTML, and any application can set any properties on our HTML elements.
The whole application logic that you're providing with this change can be achieved by just adding this one line and then the application setting itemKey
the same way as in your example, or any other property with any name they like. It doesn't need to be a component/metadata property, because it has nothing to do with the component itself. We do such things in OpenUI5, because there apps don't have access to HTML directly and it's more inconvenient to set custom stuff (f.e. they can only use LayoutData)
filterItems
to ui5-confirm
event details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should sync filterItems with filters and only return the selected filterItems. Now you receive all of the filterItems, without even selecting one. Please return only the selected filters.
filterItems
to ui5-confirm
event detailsfilterItems
to ui5-confirm
event details
…o `ui5-confirm` event details (#9838) We are now providing the slotted ui5-filter-item's in the ui5-confirm event details. This way the app developers could be able to selectively filter the selected items by property of their liking (for example by adding data-key (or similar) attribute/property to the ui5-filter-item-option's or ui5-filter-item's);
Previously, when confirming the selection in the View Settings Dialog, the visible UI text of the selected item was returned. However, this text doesn't always match the value required by the backend service for example, and it can also change due to translations or other factors, creating inconsistencies.
To address this, we are now providing the slotted
ui5-filter-item
's in theui5-confirm
event details.This way the app developers could be able to selectively filter the selected items by property of their liking (for example by adding
data-key
(or similar) attribute/property to theui5-filter-item-option
's orui5-filter-item
's);Sample usage:
Fixes: #7579
Fixes: #6910