[英]SAPUI5 - Dynamic odata binding to select box
I am working on the select box binding. 我正在选择框绑定。 I want to bind data to the select box which is coming from odata service. 我想将数据绑定到来自odata服务的选择框。 Below is my code. 下面是我的代码。 My model is set and I can get the model value in the console. 我的模型已经设置好,可以在控制台中获取模型值。 But not able to bind to select box. 但无法绑定到选择框。
var oModel = this.getView().getModel("rulelist");
var Zid = '0';
var Zidentifier1 = 'Default Vendor';
var Zidentifier2 = '111111';
var aFilter = [];
var noModel = new sap.ui.model.json.JSONModel();
aFilter.push(new Filter("Zid", FilterOperator.EQ, Zid));
aFilter.push(new Filter("Zidentifier1", FilterOperator.EQ, Zidentifier1));
aFilter.push(new Filter("Zidentifier2", FilterOperator.EQ, Zidentifier2));
oModel.read("/ZruleAttributeSet", {
filters: aFilter,
success: function(data) {
var attrResult = data.results;
var headerFields = "";
var aTtributes = [];
for (var k = 0; k < attrResult.length; k++) {
aTtributes.push({attribute:attrResult[k].Zattribute});
headerFields += "attribute: "+attrResult[k].Zattribute + ",";
}
noModel.setData({
items: aTtributes
});
sap.ui.getCore().setModel(noModel, "newData");
console.log(sap.ui.getCore().getModel("newData"));
noModel.refresh(true);
},
error: function(e) {
MessageToast.show("No Data Found !!");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.