Skip to Content
-2
Jun 19, 2020 at 05:54 PM

TypeError: Cannot read property indexOf of undefined

350 Views

I'm trying to run my project . i got this error TypeError: Cannot read property 'indexOf' of undefined.

did i miss something. what should i do . thank you

onAdd: function (oEvent) {

var OData = new sap.ui.model.odata.ODataModel();

var title = this.getView().byId("input0").getValue();

var note = this.getView().byId("input2").getValue();

var status = this.getView().byId("group0").getSelectedIndex();

var requestObj = {

requestUri : '', method : '',

headers : { "X-Requested-With": "XMLHttpRequest",

"Content-Type": "application/json; odata.metadata=minimal",

"DataServiceVersion": "4.0",

"MaxDataServiceVersion":"4.0",

"Accept": "application/json; odata.metadata=minimal"

} };

var newData = { "odata.type":"todo.Task", "title": title, "note": note, "status": status };

if(this.mode === 'create')

{ var url = "/service_api/odata/v4/todo/Task";

var method = "POST";

requestObj.requestUri=url;

requestObj.method=method;

requestObj.data=newData;

}

this.oModel.request(requestObj,function (){

sap.ui.getCore().getModel('Task').refresh();

//this.getView().byId("packItem").getModel().refresh(true);

this.getView().byId("form0").setVisible(false);

});