Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#416 closed defect (fixed)

Menu2 menu items run application "onclick" even if disabled

Reported by: [email protected] Owned by: ilia
Priority: high Milestone:
Component: Widgets Version: 0.2
Keywords: Cc:
Blocked By: Blocking:


The Menu2 widget doesn't seem to provide for properly disabling application-specific actions when the item is disabled. The widget's onclick code properly avoids opening a submenu (if there is one), but doesn't control app-specific actions.

My proposal is to add a new event/method, which might be named "onChoose", and calling it from the widget's onclick code only when the menu item is enabled. Applications then attach actions to the "onChoose" event. My change as a patch:

@@ -497,8 +497,14 @@
+                this.onChoose();
+        onChoose: function(){
+          // placeholder for application actions
+        },
        highlightItem: function(){
                dojo.html.addClass(this.domNode, 'dojoMenuItem2Hover');

Change History (4)

comment:1 Changed 15 years ago by bill

Owner: changed from anonymous to ilia

Ilia updated MenuItem2 to use topics. onClick() calls

dojo.event.topic.publish(this.eventNames.engage, this);

(but only when enabled). But I'm not sure how you set the name of the event. By default, this.eventNames.engage=="". Ilia, can you explain?

comment:2 Changed 15 years ago by bill

Milestone: 0.3release
Resolution: fixed
Status: newclosed

Fixed in rev 3032.

comment:3 Changed 15 years ago by bill

From mail:

Yeah, I agree that

<div dojoType="MenuItem2" onClick="alert('hello world');">

is definitely a more compact syntax than using topics, especially since you can do everything in markup.

I think in the non-dojo case below, the onClick event WON'T get fired, right?

<button disabled="true" onClick="alert('hello world');">push me</button>

So, I've done the same for menu items.

comment:4 Changed 13 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.