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

Example about mat-optgroup inside mat-autocomplete #10196

Closed
WizardPC opened this issue Feb 28, 2018 · 12 comments · Fixed by #10666
Closed

Example about mat-optgroup inside mat-autocomplete #10196

WizardPC opened this issue Feb 28, 2018 · 12 comments · Fixed by #10666
Labels
docs This issue is related to documentation feature This issue represents a new feature or feature request rather than a bug or bug fix help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions

Comments

@WizardPC
Copy link

WizardPC commented Feb 28, 2018

Bug, feature request, or proposal:

Documentation request

What is the expected behavior?

Having an working example of this code :
https://material.angular.io/components/autocomplete/overview#option-groups

What is the current behavior?

No stackblitz or demo. And it's not easy to understand... because for the "mat-optgroup" you need (implicitly ?) to go to the "Select" component section, and with a group structure (eg: pokemonGroups) the autocomplete filter (eg: filteredOptions: Observable<string[]>;) doesn't work anymore.

What are the steps to reproduce?

https://stackblitz.com/edit/angular-nwdj9u

What is the use-case or motivation for changing an existing behavior?

Having a autocomplete input with group.

Like this for example

Input : "d" <---------- autocomplete
[D <------------------- group
Dog <------------- option1
Dragon <---------- option2
...
]

@jelbourn jelbourn added feature This issue represents a new feature or feature request rather than a bug or bug fix docs This issue is related to documentation help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions labels Mar 1, 2018
@WizardPC
Copy link
Author

WizardPC commented Mar 2, 2018

Thanks @jelbourn for the tags.

Indeed the "help wanted" is welcome, because i can't actually find myself how to adapt the Observable type to work with a group...

If someone know how to do it, I will really appreciate !!

@WizardPC
Copy link
Author

WizardPC commented Mar 2, 2018

Comment updated with a stackblitz demo.

@WizardPC
Copy link
Author

No one ? No more luck on stackoverflow... 🤐

@raygervais
Copy link
Contributor

I'd like to take a crack at this if @mmalerba thinks it's a feature worth adding 👍

@mmalerba
Copy link
Contributor

@raygervais sounds good to me. @crisbeto should probably be the one to review it, I'm not too familiar with the autocomplete

@raygervais
Copy link
Contributor

@WizardPC, I forked and completed your mat-optgroup example. Can be found here: https://stackblitz.com/edit/angular-smg2xm?file=app/app.component.ts, from there I'm updating the documentation to reflect (based on the original example which is there). @crisbeto is this how the autocomplete function should behave? or should it filter as well the options so that if I put Dr from the example above, Dog would be removed from the panel?

@crisbeto
Copy link
Member

crisbeto commented Apr 1, 2018

I'd say that it should only filter the options @raygervais, the groups are only used for grouping similar results together. Here's an example from our demo app that does the same: https://github.com/angular/material2/blob/master/src/demo-app/autocomplete/autocomplete-demo.ts#L131

@raygervais
Copy link
Contributor

raygervais commented Apr 2, 2018

Thanks for the pointer @crisbeto, will correct in my StackBlitz update and from there work on the PR.
Edit, corrected in the above StackBlitz link to follow the same code base which you specified above @crisbeto. I'll create a PR for it today 👍

@WizardPC
Copy link
Author

WizardPC commented Apr 2, 2018

@raygervais thanks for your time ! Works as expected ;)

@WizardPC
Copy link
Author

Thanks @raygervais 😉

@meyer20
Copy link

meyer20 commented May 25, 2018

Hi @raygervais

Is possible to do something like this: https://i.stack.imgur.com/tvAp5.png using the autocomplete, i say, multiple colums in a line.

Thanks

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs This issue is related to documentation feature This issue represents a new feature or feature request rather than a bug or bug fix help wanted The team would appreciate a PR from the community to address this issue P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants