Demo:Menu_SAP刘梦_新浪博客

效果

代码

 

<<span style="color:#3f7f7f">script>

    //Function to handle the select event of the items

    var handleSelect = function(oEvent) {

        alert(oEvent.getParameter("item").getId());

 

    };

 

    //create menu

    var oMenu = new sap.ui.commons.Menu("menu");

    oMenu.setAriaDescription("Menu");

 

    //create item

    var oMenuItem1 = new sap.ui.commons.MenuItem("item1", {

        text : "子菜单1"

    });

    var oMenuItem2 = new sap.ui.commons.MenuItem("item2", {

        text : "子菜单2"

    });

 

    var oMenu_sub1 = new sap.ui.commons.Menu("subM");

    var oMenuItem11 = new sap.ui.commons.MenuItem("item11", {

        text : "子菜单11"

    });

    var oMenuItem12 = new sap.ui.commons.MenuItem("item12", {

        text : "子菜单12"

    });

 

    oMenuItem1.setSubmenu(oMenu_sub1);

    oMenu_sub1.addItem(oMenuItem11);

    oMenu_sub1.addItem(oMenuItem12);

 

    oMenu.addItem(oMenuItem1);

    oMenu.addItem(oMenuItem2);

 

    //event

oMenuItem2.attachSelect(handleSelect);

    oMenuItem11.attachSelect(handleSelect);

    oMenuItem12.attachSelect(handleSelect);

    // Create a Link which opens the menu on click

    var oLink1 = new sap.ui.commons.Link("link1", {

        text : "Menu Click"

    });

    oLink1

            .attachPress(function() {

                var eDock = sap.ui.core.Popup.Dock;

                oMenu

                        .open(

                                false ,

                                oLink1.getFocusDomRef() ,

                                eDock.BeginTop,

                                eDock.BeginBottom,

                                oLink1.getDomRef()

                        );

            });

 

    // Attach the link to the page

    oLink1.placeAt("content");

</<span style="color:#3f7f7f">script>

 

友情推广:

第一课堂HANA系统搭建完成,公网双IP访问,速度有保证,

进第一课堂群139446252,免费领取HANA测试账号。

申请时验证信息可输入来自本博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值