Templarian / ui.bootstrap.contextMenu

AngularJS Bootstrap UI Context Menu
MIT License
259 stars 127 forks source link

In nested menu allow action on nested sub menu parent #94

Closed krzysieki closed 7 years ago

krzysieki commented 7 years ago

In a given context menu:

item 1
item 2 > sub-item 2.1
         sub-item 2.2

it is possible to attach actions only to items: item 1, sub-item 2.1, sub-item 2.2

It should be possible to attach action also on "item 2" (which is a parent to nested submenu with "sub-item 2.1" and "sub-item 2.2")

PS Thanks for your work!

josetaira commented 7 years ago

hi @krzysieki what is your use case for this? Just curious. Because normally if you have a sub-menu, the purpose of the parent is only to display that sub-menu.

krzysieki commented 7 years ago

Please consider scenarios:

example 1. We have items and categories in our system. Categories can contain sub-categories (tree structure). Now in UI there is a function to attach a category to an item. Function can be achieved via context menu: right click on item -> list of categories in context menu -> now we can choose one of categories (even if it has children) or subcategories.

example 2. We have files and folders. Folders are structured in tree. And there is a function to move files between folders. Right click on file -> context menu "move to >" -> now we have list of destination folders, but some of them can contain subfolders.

I know that described scenarios are not perfect UI/UX solutions but believe me that these are real use cases :)

muzuro commented 7 years ago

This feature will be usefull for me too

josetaira commented 7 years ago

Due to the current structure of the code, this doesn't seem to be easily possible since item[1] is already used to contain the children and therefore cannot also contain the function. I'm planning on doing some changes to allow this to happen. Will keep you posted

josetaira commented 7 years ago

@krzysieki @muzuro this should be fixed as of 5e03256d40c7af4eed50eea5014143dcfb45f246

Just specify both click and children for the new object-based implementation.