I need to have dynamic submenus - is this possible? I'm trying to do something like the following but when I try to access the menu item by ID, I get an error saying it doesn't exist. How do I (if possible) accomplish this?
Code:
isc.Menu.create({
ID: "menu",
autoDraw: false,
showShadow: true,
shadowDepth: 10,
data: [
{title: "New", keyTitle: "Ctrl+N", icon: "icons/16/document_plain_new.png"},
{title: "Open", keyTitle: "Ctrl+O", icon: "icons/16/folder_out.png"},
{isSeparator: true},
{title: "Save", keyTitle: "Ctrl+S", icon: "icons/16/disk_blue.png"},
{title: "Save As", icon: "icons/16/save_as.png"},
{isSeparator: true},
{title: "Recent Documents", icon: "icons/16/folder_document.png", submenu: [
{title: "data.xml", checked: true},
{title: "Component Guide.doc"},
{title: "SmartClient.doc", checked: true},
{title: "AJAX.doc"}
]},
{isSeparator: true},
{ID:"testme",title: "Export as...", icon: "icons/16/export1.png"},
{isSeparator: true},
{title: "Print", enabled: false, keyTitle: "Ctrl+P", icon: "icons/16/printer3.png"}
]
});
isc.MenuButton.create({
ID: "menuButton",
title: "File",
width: 100,
menu: menu
});
isc.Button.create({left:400,
click: function(){
testme.submenu = [
{title: "XML"},
{title: "CSV"},
{title: "Plain text"}
];
}
})
Comment