Hello Robin,
Ideally code for binding update should be in route pattern match handler function so that it should be called every time when the view is navigated to as compared to onInit() which will be triggered for the first time only.
But I will give a simple sample for onInit() (try and post in case of error as i have not tried below codebase)
Controller -
onInit(){
// Create data object
var oData = [{
"key": "1",
"test": "Customer"
}, {
"key": "2",
"test": "Competitor"
}]
// Create JSON model
this.oModel = new sap.ui.model.json.JSONModel({});
// Set the JSON model on view with name 'jsonModel'
this.setModel(this.oModel, "jsonModel");
// Bind the data to the JSON model which will be used in view
this.oModel.setProperty("/BPGroupType", oData );
}
View -
Use as -
<Select items="{path:'/BPGroupType'}" selectedKey="{jsonModel>/key}">
<core:Item key="{key}" text="{test}"/>
</Select>
BR.