简体   繁体   English

如何在 sap ui5 中动态创建的菜单中绑定 omodel 数据?

[英]how to bind omodel data in dynamically created Menu in sap ui5?

I want to bind description in menu items as below screenshot:我想在菜单项中绑定描述,如下图所示:

            var menu=new sap.m.Menu({
                path : "/plants",
                title: "Notes For1234: ",
                template: new sap.m.MenuItem({                                        
                       text: "{description}",
                       })


            });
            that.getView().addDependent(menu);

            menu.setModel(thisOfBtn.getModel());
            const eDock = sap.ui.core.Popup.Dock;
            menu.openBy(oButton,false, eDock.BeginTop, eDock.BeginBottom, false);
        }

[代码图像] 1 1

image of menu菜单图片在此处输入图像描述

I want to bind description in menu items as below screenshot:我想在菜单项中绑定描述,如下图所示:

            var menu=new sap.m.Menu({
                path : "/plants",
                title: "Notes For1234: ",
                template: new sap.m.MenuItem({                                        
                       text: "{description}",
                       })


            });
            that.getView().addDependent(menu);

            menu.setModel(thisOfBtn.getModel());
            const eDock = sap.ui.core.Popup.Dock;
            menu.openBy(oButton,false, eDock.BeginTop, eDock.BeginBottom, false);
        }

[代码图像] 1 1

image of menu菜单图片在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM