on 08-20-2020 4:50 PM
Hello Experts,
Below is my code:
that.oModel.read("/ZDB_DETAIL", {
filters: aFilter_Detail,
success: function(oData, oResponse) {
var oModel_DetailModel = new sap.ui.model.json.JSONModel();
var data = {
"detailDataRows": oData.results
}
oModel_DetailModel.setData(data);
that.getView().setModel(oModel_DetailModel , "DATA_DETAIL");
}.bind(that),
error: function(request, error) {
sap.m.MessageToast.show("No Data exists.");
that.FLAG_NEW = true;
that.onInitGenerateRows;
}.bind(that)
In the below method: I am trying to get the property "/detailDataRows" from the model. But it returns undefined. All the oData.results are in object form instead of one object detailDataRows : [ oData.results] .
onAdd: function() {
debugger;
var oModel = this.getView().getModel().getProperty("/detailDataRows"); // undefined
}
Can anyone help me how to set a new property to the model?
Thanks & Regards,
Zayid
When attach the model to the view you have used the name "DATA_DETAIL". You have to use the same name when you retrieve the model from the view.
this.getView().getModel("DATA_DETAIL") ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.