I'm working with SAPUI5 and OpenUI5. I'ved developed some custom controls for now but never used the 2-Way Databinding for this controls...I've tried it with
oMyControl.bindProperty("someValue", "oModel>/testBindingValue")
What I've seen is: When watching the Model in the debugger the field aBindings have one entry:
sPath: "/testBindingValue"
sInternalType: "int"
and the correct sInternalType of my Controls property type (in this case "int").
But when I'm watching the array oModel.oData it is empty and oModel.getProperty("/testBindingValue")
is also returning undefined...but my control definitely has a value for "someValue"...So, does anyone have an idea?
Thanks, Alex
UPDATE:
Here you see my workflow:
first creating the model:
var oModel = new sap.ui.model.json.JSONModel();
sap.ui.getCore().setModel(oModel, 'oModel');
then initializing my control:
var oMyControl = new MyControl({
someValue: "Test Value of the Control"
});
oMyControl.bindProperty("someValue", "oModel>/testValue");
Now, when I'm doing:
alert(oModel.getProperty("/testValue"));
I will get "undefined".
So, for normal controls this is working, for "value", "text", "visible" or "enabled" and so on..