PDA

View Full Version : How do you retrieve checked item in menu and submenu?



n01champion
22 Feb 2007, 5:55 AM
I have a checkItem group and I set the first item to checked.. how do i call my checkHandler, of the first item that is already checked, when the page loads.

I have a menu checkItem group and a submenu checkItem group

thanks in advance

jack.slocum
22 Feb 2007, 6:37 AM
Can you explain a little further? Thanks.

n01champion
22 Feb 2007, 7:01 AM
ok here is little snippet of my code....

How do I get the "id" of the first item (DE) in the submenu

OR

How do i detect the first item which is already checked and run its function on first load.. because when you define it as checked and then loads the function doesnt get called.. you have to click on the second item then click back on the first item.



var seqMenu = new Ext.menu.Menu({
id: 'seqMenu',
items: [
{
id: 'pieceType',
text: 'Piece Type',
menu: {
items:[
new Ext.menu.CheckItem({
id: 'DE',
text:'Default/All',
checked:true,
group:'piecetype',
checkHandler: mailPlants.sequenceEditor
}),
new Ext.menu.CheckItem({
id: 'LT',
text:'Letters',
group:'piecetype',
checkHandler: mailPlants.sequenceEditor
}),
new Ext.menu.CheckItem({
id: 'FL',
text:'Flats',
group:'piecetype',
checkHandler: mailPlants.sequenceEditor
}),
new Ext.menu.CheckItem({
id: 'LF',
text:'Letters or Flats',
group:'piecetype',
checkHandler: mailPlants.sequenceEditor
}),
new Ext.menu.CheckItem({
id: 'CO',
text:'Catalog Outlets',
group:'piecetype',
checkHandler: mailPlants.sequenceEditor
}),
new Ext.menu.CheckItem({
id: 'CT',
text:'Catalogs',
group:'piecetype',
checkHandler: mailPlants.sequenceEditor
})
]
}
}]
});

Belgabor
22 Feb 2007, 7:35 AM
Maybe I don't fully understand, but can't you simply call the callback after initializing the menu?


mailPlants.sequenceEditor({id: 'DE'}, true);