on 08-27-2013 9:32 AM
Hello,
When we create an odatamodel (not a named model), the textfield in the view is populated with a value. So everything works fine.
However when we create the odatamodel as a named model there seems to be no way to do a property binding.
Let me give you an example with the "http://services.odata.org/Northwind/Northwind.svc/" service .
Controller:
var oModel = new sap.ui.model.odata.ODataModel("http://services.odata.org/Northwind/Northwind.svc/");
sap.ui.getCore().setModel(oModel);
View:
var oTf = new sap.ui.commons.TextField('input1');
oTf.bindElement("/Categories(1)");
oTf.bindProperty("value", {
path: "CategoryName"
});
return oTf;
However : when we want the odatamodel to be a named model, the value in the textfield is not populated anymore.
Controller:
var oModel2 = new sap.ui.model.odata.ODataModel("http://services.odata.org/Northwind/Northwind.svc/");
sap.ui.getCore().setModel(oModel2, "testModel");
View:
var oTf = new sap.ui.commons.TextField('input1');
oTf.bindElement("/Categories(1)");
oTf.bindProperty("value", {
path: "CategoryName",
model: "testModel"
});
return oTf;
We tried several settings with path like testModel>/Categories(1) but no luck.
Could anyone tell us how to use the oDataModel as a named model with regards to property binding?
Any help will be appreciated.
Regards,
Bert
Hi Bert,
please try the following:
var oTf = new sap.ui.commons.TextField('input1');
oTf.bindElement("testModel>/Categories(1)");
oTf.bindProperty("value", "testModel>CategoryName");
return oTf;
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.