Skip to Content

Odata Model SetProperty, SetModel, GetModel Error

Hello Experts,

Below is my code:"/ZDB_DETAIL", {
                            filters: aFilter_Detail,
                            success: function(oData, oResponse) {
                                    var oModel_DetailModel = new sap.ui.model.json.JSONModel();
                                    var data = {
                                        "detailDataRows": oData.results
                                    that.getView().setModel(oModel_DetailModel , "DATA_DETAIL");
                            error: function(request, error) {
                      "No Data exists.");
                                that.FLAG_NEW = true;

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() {
            var oModel = this.getView().getModel().getProperty("/detailDataRows"); // undefined

Can anyone help me how to set a new property to the model?

Thanks & Regards,


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Aug 20 at 06:57 PM

    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") ...
    Add a comment
    10|10000 characters needed characters exceeded