Nov 16, 2009, 5:59 PM
[CLOSED] Dynamic Menu Generation from Comma Delimited String
Hi,
I have an array of strings file1, file2, file3
and I would like to convert them into a <ext:Splitter>
with menu items.
How can I dynamically build this?
I created one manually, and looked at the javascript it produced it, and linked "DoIt" to a button...and the everything worked great. I'm just having trouble understanding how to create this dynamically? I have the comma delimited string coming from the database, and would like to attach a <render hander=**function**> that will take this comma delimited string, and create a menu. See image attached.
Here is my code, but I need to make this dynamic so that it creates a button in each row....again, see attached image.
I have an array of strings file1, file2, file3
and I would like to convert them into a <ext:Splitter>
with menu items.
How can I dynamically build this?
I created one manually, and looked at the javascript it produced it, and linked "DoIt" to a button...and the everything worked great. I'm just having trouble understanding how to create this dynamically? I have the comma delimited string coming from the database, and would like to attach a <render hander=**function**> that will take this comma delimited string, and create a menu. See image attached.
Here is my code, but I need to make this dynamic so that it creates a button in each row....again, see attached image.
function DoIt() {
Ext.onReady(function() {
this.menu = new Ext.menu.Menu({
proxyId: "menu", items: [
new Ext.menu.Item({
id: "MenuItem0", text: "File1", iconCls: "icon-page", listeners: {
click: {
fn: function(el, e) {
return NavigateTo('File1')
}
}
}
}
), new Ext.menu.Item({
id: "MenuItem1", text: "File2", iconCls: "icon-page", listeners: {
click: {
fn: function(el, e) {
return NavigateTo('File2')
}
}
}
}
), new Ext.menu.Item({
id: "MenuItem2", text: "File3", iconCls: "icon-page", listeners: {
click: {
fn: function(el, e) {
return NavigateTo('File3')
}
}
}
}
)
]
}
); new Ext.SplitButton({
id: "btn", renderTo: "btnAttach", text: "Attachments", menu: menu, iconCls: "icon-attach"
}
);
}
);
Ext.QuickTips.init();
Coolite.ScriptManager = "ScriptManager1";
Ext.BLANK_IMAGE_URL = "/Intranet/extjs/resources/images/slate/s-gif/coolite.axd";
}