Skip to content

Nested submenus in dropdown options #1538

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

Open
Sakthi002 opened this issue Nov 10, 2021 · 6 comments
Open

Nested submenus in dropdown options #1538

Sakthi002 opened this issue Nov 10, 2021 · 6 comments

Comments

@Sakthi002
Copy link

Currently Options value :
[
{ id : 1, name : 'test'},
{ id : 2, name : 'test 1'},
]

Behaviour :
image

Expecting behaviour :

[
{ id : 1, name : 'A',children : [{ id : 1, name : 'AA'},{ id : 2, name : 'AB'}]},
{ id : 2, name : 'B', children : [{ id : 1, name : 'test'},{ id : 2, name : 'test 1'}]},
]

image

@Papooch
Copy link

Papooch commented Nov 30, 2021

I guess this is already doable using the option slot by passing a custom template.

@Sakthi002
Copy link
Author

I guess this is already doable using the option slot by passing a custom template.

@Papooch please share some example code.

@Papooch
Copy link

Papooch commented Dec 1, 2021

Actually, I was thinking about it. What is the desired behavior here? Can you select a root node as the choice? Or are those only a separator? Should you be able to expand/collapse the nodes by clicking (that one would not be possible I guess)? Should all the root nodes still show up if none of their child nodes match?

@Sakthi002
Copy link
Author

Actually, I was thinking about it. What is the desired behavior here? Can you select a root node as the choice? Or are those only a separator? Should you be able to expand/collapse the nodes by clicking (that one would not be possible I guess)? Should all the root nodes still show up if none of their child nodes match?

Can you select a root node as the choice? - Yes
Should you be able to expand/collapse the nodes by clicking - Yes

@Papooch
Copy link

Papooch commented Dec 1, 2021

I tried to put together a quick demo with the first feature: https://jsfiddle.net/5ea7zc8n/16/
It may be possible to add the collapsing with some events that modify the nodes array (like set collapsed = true) and make the search better by passing a callback function as options, but I hope you get the idea.

@Sakthi002
Copy link
Author

I tried to put together a quick demo with the first feature: https://jsfiddle.net/5ea7zc8n/16/ It may be possible to add the collapsing with some events that modify the nodes array (like set collapsed = true) and make the search better by passing a callback function as options, but I hope you get the idea.

Thank you very much @Papooch 👍 . i got some idea.

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

2 participants