UI5 odata未能向下钻取

时间:2018-03-11 21:37:01

标签: odata sapui5

您好我为oData请求设置了绑定上下文,并且该请求被称为正常。 但是在ui5上,我收到以下错误:

无法深入查看Id,无效段:Id - ../oData/Users('44ce4852-5985-44c3-9a75-03e252747d29')?$select=Email,FirstName,Id,LastName,UserName sap。 ui.model.odata.v4.lib._Cache

控制器:

        onInit: function () {

            this.getRouter().getRoute("userDetails").attachPatternMatched(this._onObjectMatched, this);
        },


        _onObjectMatched: function (oEvent) {
            var sUserId = oEvent.getParameter("arguments").userId;

            console.log(sUserId);

            this.getView().bindElement({
                path: "/Users('"+sUserId+"')",
                model: "som"
            });

            console.log(sUserId);
        },

查看:

<Page  >

    <fLayout:SimpleForm editable="true"
                        layout="ResponsiveGridLayout"
                        title="{i18n>settings.user.title}"
                        labelSpanXL="3"
                        labelSpanL="3"
                        labelSpanM="3"
                        labelSpanS="12"
                        emptySpanXL="4"
                        emptySpanL="4"
                        emptySpanM="4"
                        emptySpanS="0"
                        columnsXL="1"
                        columnsL="1"
                        columnsM="1" >
        <fLayout:content>

            <Label text="{i18n>settings.user.id}" />
            <Input editable="false" value="{som>Id}" />

            <Label text="{i18n>settings.user.userimage}" />
            <f:Avatar press="onAvatarPressed" imageFitType="Contain" displaySize="XL" />

            <Label text="{i18n>settings.user.username}" />
            <Input value="{som>UserName}" />

            <Label text="{i18n>settings.user.email}" />
            <Input value="{som>Email}" />

            <Label text="{i18n>settings.user.firstname}" />
            <Input value="{som>FirstName}" />

            <Label text="{i18n>settings.user.lastname}" />
            <Input value="{som>LastName}" />

        </fLayout:content>
    </fLayout:SimpleForm>
</Page>

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,我的请求是返回一个列表而不是单个对象。