I have been working on this for a couple of days. So far I have the Menu loading but clicking on the menu items crash the menu and deletes all of the menu items.
Here is what I have working at this point:
var MenuButton = isc.MenuButton.create({
autoDraw: false,
title: "MainMenu",
width: 160,
menu: isc.Menu.create({
dataSource: "MenusDS",
canSelectParentItems: false,
reportCollisions: false,
itemClick: function (item) {
isc.say(item.AppURL+" Selected.");
}
})
});
DataSource:
isc.RestDataSource.create({
ID:"MenusDS",
dataFormat : "json",
jsonPrefix : "",
jsonSuffix : "",
fetchSubMenus : false,
fields:[
{name:"Menu", title:"Menu", type:"text", length:128, primaryKey:true, required:true, canEdit:false},
{name:"AppURL", title:"App URL", type:"text", length:255},
{name:"parentID", hidden:true, type:"text", required:true, foreignKey:"MenusDS.Menu",
rootValue:"root", canEdit:false}
],
operationBindings:[
{operationType:"fetch", dataProtocol:"getParams",
dataURL:"https://hvs.llc/route/Accounting/assets/php/Menus.php?action=getMenusList"}
]
});
JSON returned from PHP:
{"response":{"status":0,"startRow":0,"endRow":10,"totalRows":11 ,"data":[
{"Menu":"Menu1",children:[
{"Menu":"SubMenu1","AppURL":"Menu1\/page1.html",ParentID:"Menu1"},
{"Menu":"SubMenu2","AppURL":"Menu1\/page2.html",ParentID:"Menu1"}
]},
{"Menu":"Menu2",children:[
{"Menu":"SubMenu21","AppURL":"Menu2\/page1.php",ParentID:"Menu2"},
{"Menu":"SubMenu22","AppURL":"Menu2\/Page2.php",ParentID:"Menu2"}
]},
{"Menu":"Menu3",children:[
{"Menu":"SubMenu31","AppURL":"Menu3\/page1.html",ParentID:"Menu3"},
{"Menu":"SubMenu32","AppURL":"Menu3\/page2.html",ParentID:"Menu3"}
]},
{"Menu":"Menu4",children:[
{"Menu":"SubMenu41","AppURL":"Menu4\/page1.html",ParentID:"Menu4" }
]}
]}}';
Here is what I have working at this point:
var MenuButton = isc.MenuButton.create({
autoDraw: false,
title: "MainMenu",
width: 160,
menu: isc.Menu.create({
dataSource: "MenusDS",
canSelectParentItems: false,
reportCollisions: false,
itemClick: function (item) {
isc.say(item.AppURL+" Selected.");
}
})
});
DataSource:
isc.RestDataSource.create({
ID:"MenusDS",
dataFormat : "json",
jsonPrefix : "",
jsonSuffix : "",
fetchSubMenus : false,
fields:[
{name:"Menu", title:"Menu", type:"text", length:128, primaryKey:true, required:true, canEdit:false},
{name:"AppURL", title:"App URL", type:"text", length:255},
{name:"parentID", hidden:true, type:"text", required:true, foreignKey:"MenusDS.Menu",
rootValue:"root", canEdit:false}
],
operationBindings:[
{operationType:"fetch", dataProtocol:"getParams",
dataURL:"https://hvs.llc/route/Accounting/assets/php/Menus.php?action=getMenusList"}
]
});
JSON returned from PHP:
{"response":{"status":0,"startRow":0,"endRow":10,"totalRows":11 ,"data":[
{"Menu":"Menu1",children:[
{"Menu":"SubMenu1","AppURL":"Menu1\/page1.html",ParentID:"Menu1"},
{"Menu":"SubMenu2","AppURL":"Menu1\/page2.html",ParentID:"Menu1"}
]},
{"Menu":"Menu2",children:[
{"Menu":"SubMenu21","AppURL":"Menu2\/page1.php",ParentID:"Menu2"},
{"Menu":"SubMenu22","AppURL":"Menu2\/Page2.php",ParentID:"Menu2"}
]},
{"Menu":"Menu3",children:[
{"Menu":"SubMenu31","AppURL":"Menu3\/page1.html",ParentID:"Menu3"},
{"Menu":"SubMenu32","AppURL":"Menu3\/page2.html",ParentID:"Menu3"}
]},
{"Menu":"Menu4",children:[
{"Menu":"SubMenu41","AppURL":"Menu4\/page1.html",ParentID:"Menu4" }
]}
]}}';
Comment