PDA

View Full Version : How to uncheck the menu?



icedtiger
16 Sep 2009, 11:50 PM
I put a menu in a toolbar like this


tbar: [
{
text: 'My Menu',
iconCls: 'mymenu',
menu: new Ext.menu.Menu({
items: [MenuJson]
})
}
]where the MenuJson like this

[{"id":"1","text":"Item1","hideOnClick":false,"handler":"onItemCheck","checked":false},
{"id":"2","text":"Item1","hideOnClick":false,"handler":"onItemCheck","checked":false}
{"id":"3","text":"Item1","hideOnClick":false,"handler":"onItemCheck","checked":false}]every menuitem has a checkbox in its left
now i want to have the menuitems be unchecked everytime i open the menu,
i have tried removing class 'x-menu-item-checked' from the items
they seem to be unchecked,but in fact checked.

any ideas?

Condor
17 Sep 2009, 12:03 AM
Try:

menu.on('beforeshow', function(menu){
menu.items.each(function(comp){
if(comp.setChecked){
comp.setChecked(false, true);
}
});
});

icedtiger
17 Sep 2009, 12:50 AM
:D,it works,thanks.