将数据绑定到控制sap ui5的id

时间:2017-12-21 03:47:48

标签: data-binding sapui5

我正在使用SAP UI5和对象模型进行绑定控制。

<layout:VerticalLayout content="{oModel>/part2/chartContents}" width="100%">
                                    <layout:fixContent>
                                        <viz:VizFrame id="{oModel>id}" uiConfig="{applicationSet:'fiori'}" vizType='column' >
                                            <viz:dataset>
                                                <viz.data:FlattenedDataset data="{oModel>data/milk}">
                                                    <viz.data:dimensions>
                                                        <viz.data:DimensionDefinition name="Week" value="{oModel>Week}" />
                                                    </viz.data:dimensions>
                                                    <viz.data:measures>
                                                        <viz.data:MeasureDefinition name="Revenue" value="{oModel>Revenue}" />
                                                        <viz.data:MeasureDefinition name="Cost" value="{oModel>Cost}" />
                                                    </viz.data:measures>
                                                </viz.data:FlattenedDataset>
                                            </viz:dataset>
                                            <viz:feeds>
                                                <viz.feeds:FeedItem id='valueAxisFeed' uid="valueAxis" type="Measure" values="Revenue" />
                                                <viz.feeds:FeedItem id='categoryAxisFeed' uid="categoryAxis" type="Dimension" values="Week" />
                                            </viz:feeds>
                                        </viz:VizFrame>
                                    </layout:fixContent>
                                </layout:FixFlex>
                            </layout:VerticalLayout>

我的数据模型:

var oModel = new sap.ui.model.json.JOSNModel({part2: {chartContents: [{
                            title: "a. tile 1",
                            linkText: "detail",
                            id: "idoChart1
                            metaData: {
                                reportName: "first Report",
                                from: "",
                                to: ""
                            },
                            data: {
                                "milk": [{
                                        "Week": "Week 1 - 4",
                                        "Revenue": 431000.22,
                                        "Cost": 230000,
                                        "Cost1": 24800.63,
                                        "Cost2": 205199.37,
                                        "Target": 500000,
                                        "Budget": 210000
                                    }]
                                   }
           }]}})
this.getView().setModel(oModel, "oModel");

但是在属性id="{oModel>id}"中,它不起作用,尽管其他属性具有正确的值。

问题

如何将对象模型中的值(ID)绑定到控制SAP UI5?

0 个答案:

没有答案