I want to bind JSON Data to view I have tried as below:
XML:
<m:Select id="Employee" items="{Employee>/EmployeeList}">
<c:Item key="{Employee>key}" text="{Employee>value}" />
<m:layoutData>
<l:GridData span="L2 M2 S2"/>
</m:layoutData>
This is how my JSON data is :
var xyz = {
"Employee": {
"EmployeeList": [{
"key": "ram",
"value": "ram"
},
{
"key": "raj",
"value": "raj"
},
{
"key": "rani",
"value": "rani"
}
]
}
}
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(xyz);
this.getView().setModel(oModel);
I have a select box in view I want to show the employee names as dropdowns in view page.How to bind this XML.Thanks in advance