-
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-multi-combobox): introduce grouping functionality #5250
Conversation
* @tagname ui5-mcb-group-item | ||
* @public | ||
* @implements sap.ui.webcomponents.main.IMultiComboBoxItem | ||
* @since 1.0.0-rc.15 |
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 since
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.
Done
@@ -1055,7 +1057,29 @@ class MultiComboBox extends UI5Element { | |||
} | |||
|
|||
_filterItems(str) { | |||
return (Filters[this.filter] || Filters.StartsWithPerTerm)(str, this.items); | |||
const itemsToFilter = this.items.filter(item => !item.isGroupItem); |
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.
At first glance it looks a little complicated these two methods.
Something that might help to look more straightforward is to build a map or other structure (probably onBeforeRendering) to store the connection between items and the groups they belong. And, when the user filters, it will be much less code, more readable, to get from that structure which group items should be displayed for which items that remained after filtering. But, this is more for the team review.
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.
I think the same, Can we change the filters files to consider group items as that is implemented in both CB and MCB components?
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.
as all combobox / mcb items and group items all implement the IComboBoxItem
can we introduce a method e.g. #isGroupItem?
or something like this?
And there is a merge conflict packages/main/test/pages/MultiComboBox.html to be resolved |
* | ||
* @private | ||
*/ | ||
static _groupItemFilter(item, idx, allItems, filteredItems) { |
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.
Rename the idx param to nextItemIdx for readibility
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.
Overall looks good to me, the only thing that comes on my mind is that with huge collection of items grouping could have some performance impact as we are doing filtering twice now. If we optimise this we are good to go I believe.
FIXES: #5060