如何在欢迎窗口中显示oData内容

时间:2019-02-18 13:04:01

标签: javascript html odata sapui5

如何从oData服务以html标记显示数据。这是UI插件。

请找到下面给出的片段代码。我必须显示此区域中的数据,其中需要根据某些条件进行手动输入。如果您还有其他想法,请分享。请在Git URL - zwelcomepopup

中找到我的项目

欢迎使用GW系统,请按关闭按钮以开始您的活动。

<VBox>
    <html:div style="background-color: #fff; padding: 32px 16px 0 16px; margin: 0; overflow: hidden; font-family: Arial, Calibri, Tahoma, Geneva, sans-serif; background-color: #fff; min-height: 296px;">
        <html:h1 style="color: #007cc0; font-size: 25px; padding-bottom: 16px; border-bottom: solid #cdcdcd 4px; font-weight: normal; margin: 0;">
            Whats New</html:h1>
        <html:p style="color: #666; line-height: 20px; margin-bottom: 0; font-size: 16px;">
            ***Welcome to GWX system press close button to start your activity.***
        </html:p>
    </html:div>
</VBox>

1 个答案:

答案 0 :(得分:0)

您可以在component.js中打开包含OData内容的SAPUI5-对话框:

   sap.ui.define(["sap/m/Dialog"], function(Dialog) {

    return Component.extend("my.Launchpad.plugin.Component", {
        init: function() {

            //Read Data...

            var sWelcomeText = this.oModel.getProperty("/WelcomeText"); //Get the OData Content
            var oDialog = new Dialog("myDialog", {
                title: "Whats New",
                content: [
                    new sap.m.Text({
                        text: sWelcomeText
                    }).addStyleClass("sapUiSmallMargin")
                ],
                buttons: [
                    new sap.m.Button({
                        text: "Close",
                        press: function () {
                            oDialog.close();
                        }
                    })
                ]
            });
            oDialog.open();
        }
    });

});