SAP Fiori从表

时间:2016-09-20 09:48:11

标签: sap

简单的问题。我是SAP Fiori的初学者,试图从使用Web IDE SAP Fiori制作的表中检索值。但我没有成功。有人暗示如何到达那里吗?

<Table id="table0" items="{/Entity1_Set}" noDataText="Drop column list items here and columns in the area above">
                    <items><ColumnListItem counter="0" id="item1" detailPress="onShowHello" press="" type="DetailAndActive">
                            <cells>
                                <Text id="text5" maxLines="0" text="{Id}"/>
                                <Text id="text6" maxLines="0" text="{field1}"/>
                                <Text id="text7" maxLines="0" text="{field2}"/>
                                <Text id="text8" maxLines="0" text="Euro"/>
                            </cells>
                        </ColumnListItem>
                    </items>
                    <columns>
                        <Column id="column0">
                            <header>
                                <Label id="label0" text="Floor"/>
                            </header>
                        </Column>

.JS控制器

sap.ui.define([
    "sap/ui/core/mvc/Controller"
], function(Controller) {
    "use strict";

    return Controller.extend("QuickStartApplication.controller.View1", {
        onShowHello: function(){
            sap.m.MessageToast.show("Hello World!");
        }
    });

});

在hello world中,我想显示表格中字段的值。

1 个答案:

答案 0 :(得分:0)

您可以在函数中传递参数,该参数在事件期间调用。 另请参阅https://sapui5.hana.ondemand.com/#docs/api/symbols/sap.m.ListItemBase.html#event:detailPress

使用这些参数,您可以访问绑定数据。 请参阅以下代码,了解如何阅读ColumnListItem

的绑定上下文
detailPress : function(oEventParams){
                var oListItem = oEventParams.getSource();
                var oBindingContext = oListItem.getBindingContext(); var sSomePropertyValue = oBindingContext.getProperty("<nameOfProperty>"); }

使用.getProperty,您可以访问字段值。