vue-select icon indicating copy to clipboard operation
vue-select copied to clipboard

Nested submenus in dropdown options

Open Sakthi002 opened this issue 3 years ago • 6 comments

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

Sakthi002 avatar Nov 10 '21 10:11 Sakthi002

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

Papooch avatar Nov 30 '21 14:11 Papooch

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

@Papooch please share some example code.

Sakthi002 avatar Dec 01 '21 03:12 Sakthi002

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?

Papooch avatar Dec 01 '21 06:12 Papooch

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

Sakthi002 avatar Dec 01 '21 07:12 Sakthi002

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.

Papooch avatar Dec 01 '21 08:12 Papooch

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.

Sakthi002 avatar Dec 01 '21 09:12 Sakthi002