on 2014 Jun 06 10:16 AM
Hey guys,
I have following JSON:
"customers": [
{
"name": "Meyer",
"first_name": "Hans",
"order" : [
{
"article_number" :"123456",
"description" :"Deo"
}
]
},
I want to set the BindingContext for my control with this method:
setBindingContext(oContext, sName?)
How can i create object oContext?
I tried following, but its not working:
var oModel = this.getView().getModel("ModelKundenInfos");
var sPath = "/customers/0";
var context2 = {oModel : oModel, sPath : sPath};
Thanks + regards
Chris
Request clarification before answering.
Hi,
Please check this example Data Binding Test Page with Master Detail and JSONModel and see the source code how bindingContext is set.
Regards,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply Chandra.
Your are using the event to get the context object, I wanna create it manually. Any further ideas?
oTable.attachRowSelect(function(oEvent){
// get the binding context of the first selected row
var selectedRowContext = oEvent.getParameter("rowContext");
oItemsTable.setBindingContext(selectedRowContext);
});
Regards
Chris
So I found the solution of this problem:
To create your own bindingContext you can use
new sap.ui.model.Context(the, sPath, oContext);
So in my case:
var context3 = new sap.ui.model.Context(oModel, "/customers/0");
page.setBindingContext(context3, "ModelKundenInfos");
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.