Hi,
I'm trying to develop a SAPUI5 application. My application is made up by three parts: an header, a menu and a content area. I'm having some issues with the event handlers associated with the menu items: they are called in sequence when the view is rendered and, after that, clicking on the menu items does nothing.
This is the code I've written:
// MENU var meMenu = new sap.ui.commons.MenuBar('meMenu', {}); var miMenuMain = new sap.ui.commons.MenuItem('miMenuMain', {text: 'Views'}); var meSubMenu = new sap.ui.commons.Menu('meSubMenu', {}); var miMenuItem1js = new sap.ui.commons.MenuItem('miMenuItem1js', {text : 'jsView'}); var miMenuItem2json = new sap.ui.commons.MenuItem('miMenuItem2json', {text : 'jsonView'}); var miMenuItem3xml = new sap.ui.commons.MenuItem('miMenuItem3xml', {text : 'xmlView'}); var miMenuItem4html = new sap.ui.commons.MenuItem('miMenuItem4html', {text : 'htmlView'}); miMenuItem1js.attachSelect(new function(event) { sap.ui.jsview('jsView', 'view.jsView').placeAt('content'); }); miMenuItem2json.attachSelect(new function(event) { alert('json'); }); miMenuItem3xml.attachSelect(new function(event) { alert('xml'); }); miMenuItem4html.attachSelect(new function(event) { alert('html'); }); meSubMenu.addItem(miMenuItem1js); meSubMenu.addItem(miMenuItem2json); meSubMenu.addItem(miMenuItem3xml); meSubMenu.addItem(miMenuItem4html); miMenuMain.setSubmenu(meSubMenu); meMenu.addItem(miMenuMain); meMenu.placeAt('menu');
Thank you,
Pietro