-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
#6233 - Listbox: Preserve option groups while filtering. #6275
#6233 - Listbox: Preserve option groups while filtering. #6275
Conversation
chore: Add unit tests fixes primefaces#6233
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
const groupChildren = this.getOptionGroupChildren(group); | ||
const filteredItems = groupChildren.filter((item) => filteredOptions.includes(item)); | ||
|
||
if (filteredItems.length > 0) filtered.push({ ...group, [typeof this.optionGroupChildren === 'string' ? this.optionGroupChildren : 'items']: [...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.
What about typeof this.optionGroupChildren is not 'string'? It seems it returns 'items'.
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.
items
is a fallback - this method is the same as in MultiSelect -> https://github.com/primefaces/primevue/blob/master/packages/primevue/src/multiselect/MultiSelect.vue#L1012
and Select -> https://github.com/primefaces/primevue/blob/master/packages/primevue/src/select/Select.vue#L926
They both deal with the same data structure and I didn't want to reimplement the logic for consistency.
If the filtering logic for Listbox still needs to be changed I suggest that Select/MultiSelect is updated too, as they deal with the same data structures. What do you think?
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 I said before, it is not correct to return a string here. We are open to new solutions.
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.
Updated the PR with optimized visibleOptions
rendering logic.
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.
@tugcekucukoglu any feedback?
fix: Listbox: Preserve option groups while filtering.
chore: Add unit tests
###Defect Fixes
fixes #6233