#6226 closed enhancement (wontfix)
Menu: API enhancements
Reported by: | alex | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 1.4 |
Component: | Dijit | Version: | 1.0 |
Keywords: | menu, dijit | Cc: | |
Blocked By: | Blocking: |
Description (last modified by )
I've been working with dijit.Menu this evening, and it's really making me scratch my head about a couple of design choices.
First, there's no open() or close() methods. Instead, one must pass an instance of the Menu into dijit.popup.open() or dijit.popup.close(). This is (to say the least) unintuitive.
Secondly, I expect that menus will be re-used often, and while there's a programmatic example of adding items to a menu, no example is provided for how to remove them, nor is there a "clear()" method or similar for removing dijit.MenuItem?() instance. Similarly, there isn't a uniform "remove from parent" (not destroy()) method on MenuItem? instances.
Lastly, it would seem that the construction of a set of menu items is the common case. Supporting a JSON-style syntax for describing a set of items and their generic properties seems useful for constructing trees of menus.
Change History (3)
comment:1 Changed 13 years ago by
Milestone: | 1.2 → 1.4 |
---|---|
Owner: | set to bill |
Summary: | dijit.Menu API oddities → Menu: API enhancements |
comment:2 Changed 12 years ago by
Description: | modified (diff) |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Type: | defect → enhancement |
Replying to alex:
Secondly, I expect that menus will be re-used often, and while there's a programmatic example of adding items to a menu, no example is provided for how to remove them, nor is there a "clear()" method or similar for removing dijit.MenuItem?() instance. Similarly, there isn't a uniform "remove from parent" (not destroy()) method on MenuItem? instances.
Menu.removeChild(MenuItem?) should work, doesn't it?
Lastly, it would seem that the construction of a set of menu items is the common case. Supporting a JSON-style syntax for describing a set of items and their generic properties seems useful for constructing trees of menus.
I agree that's a common case, although it can easily be done by code outside of menu. I don't see the benefit of adding it to Menu itself, although that's debatable. There's also a possibility of dojo.data integration... if you think about it Menus and Trees are similar in their hierarchical structure, and trees work off of dojo.data.
Anyway, I'm going to close this ER for now.
The open()/close() thing is by design, a fallout from Dylan's idea that any widget should be able to be used as a popup.. thus widgets themselves don't have open/close methods. Will consider the other stuff.