PDA

View Full Version : stop my menu from dissapearing on selection!



harmomelodic
31 Dec 2009, 8:28 AM
I need my menu to persist until I click a particular item (or the parent button that holds the menu).
Any advice on how to do this is appreciated.
I ran across information on how to block ('catch') events a while back, but I can't find it again :(. If anybody knows where that page was....
I suspect if I had that information I could write a listener for 'itemClick' that stops the event from chaining to the parent, but perhaps that would cause other problems? I thought "ignoreParentClicks: true" would deal with this, but I clearly don't understand what that does as it seems to have no effect.

Here is the stripped down code for my menu. FYI the parent menu is the menu in a button in a toolbar. It all displays fine, I just need to figure out how to keep the menu up when most items are clicked.


var check_menu = new Ext.menu.Menu({
ignoreParentClicks: true,
items: [
{
text: "foo",
checked: true
},
{
text: "bar",
checked: true
}
]
});

var builder = new Ext.menu.Menu({
ignoreParentClicks: true,
items: [
{
text: "check_menu",
menu: check_menu
},
{
text: 'menu dismiss'//I need this item to dismiss the menu
}
]
})

thanks!

Animal
31 Dec 2009, 8:30 AM
http://www.extjs.com/deploy/dev/docs/?class=Ext.menu.BaseItem&member=hideOnClick

harmomelodic
31 Dec 2009, 8:40 AM
Sweet!
Thank you kindly.

I was obviously making it way more complicated than it needed to be.

For future reference, how would I block an event from chaining up (when I didn't have this kind of feature)?

Animal
31 Dec 2009, 8:54 AM
Dom events bubble up the DOM. Ext events by default do not bubble.

Some basic training required.

http://www.google.co.uk/search?q=DOM+events

harmomelodic
31 Dec 2009, 11:49 AM
Found it!

I was looking for StopEvent()

Thanks again!