on 08-21-2016 4:25 PM
I am having issues trying to bind data to a simple form. I am using a mock server and have successfully bind data to a list/table
My manifest.json looks like this
"mock": {
"dataSource": "mainService"
}
My mockdata(UserDetailsSet.json) looks like this
[{ "ID_PassNum": "cu001",
"Title": "Mr",
"Name": "Don",
"Surname": "Ownery",
"ResType": "SA",
"Country": "South Africa"
}]
My SimpleForm fields looks like this
<Input value="{mock>/UserDetailsSet/0/Name}" />
<Input value="{mock>/UserDetailsSet/0/Surname}"/>
I have also tried this
<Input value="{mock>/UserDetailsSet/('00001')/Name}" />
<Input value="{mock>/UserDetailsSet/('00001')/Surname}"/>
What am I missing?
check what the model looks like in dev tool
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
If I had a service url I would retrieve the model this way
var oModel = new sap.ui.model.odata.ODataModel(url, true);
...to get the the model. But I have a dummy url specified in the manifest.json file hence the reason I asked how to do it without a proper url
My manifest.json looks like this
"dataSources": {
"mainService": {
"uri": "/here/goes/your/serviceUrl/",
"type": "OData",
"settings": {
"annotations": [],
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
}
....
"mock": {
"dataSource": "mainService"
}
Please correct me if I am wrong
Timothy,
since you configured the model to load from manifest.json it will be created at the Component level.
to "inspect" the model just get to the point where it's already loaded with data and while stopping at any view controller ... issue this in the console
this.getView().getModel("<name of model>")
inspect the 'oData' property from the above result and share it here please.
Hi Timothy,
Try this one
<Input value="{mock>/UserDetailsSet/Name}"/>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Follow this might be helpfull....
and u need to set the model like this sap.ui.getCore().setModel(oModel);
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.