One of my tables does not load data and throws some error for one of the OData model as undefined.
<script id="sap-ui-bootstrap"
src="/resources/sap-ui-core.js"
data-sap-ui-libs="sap.m, sap.uxap, sap.ui.table"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-compatVersion="edge"
data-sap-ui-preload="async"
data-sap-ui-resourceroots='{"com.ABC": ""}'
data-sap-ui-xx-bindingSyntax="complex"
></script>
Controller.js
_initializeData: function() {
var parts = {};
parts.PartsByKey = "SP";
parts.PriceColumn = false;
parts.SubTotalColumn = false;
this.orderMaterialsModel = new JSONModel(Parts);
this.getView().setModel(this.orderMaterialsModel, "orderParts"); //Line number 6
this.orderMaterialsModel.setProperty("/OrdersTotal", 0);
/* works fine till here. But moment above statement is executed,
the execution goes to the below formatter. The model which is
initialized in the next line is never executed, and then the
formatter throws error - model undefined */
this.salesOrderModel = this.getOwnerComponent().getModel("salesOrderModel");
this._validationChecks(this.salesOrderModel.getData());
this.getView().getModel("salesOrderModel").refresh(false);
//...
},
// Formatter function for the table rows
formatQty: function(QOH, qty) {
var oType = this.salesOrderModel.oData.type;
// error here as this.salesOrderModel does not exists..
},