We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Angular Grid WebApiAdaptor error

Hello,
I'm getting the following error using grid and asp.net core web api
ERROR TypeError: Cannot read property 'indexOf' of undefined
    at WebApiAdaptor.push../node_modules/@syncfusion/ej2-data/src/adaptors.js.UrlAdaptor.processQuery (adaptors.js:452)
    at DataManager.push../node_modules/@syncfusion/ej2-grids/node_modules/@syncfusion/ej2-data/src/manager.js.DataManager.executeLocal (manager.js:116)
    at manager.js:164
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:16126)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:498)
    at ZoneTask.invoke (zone.js:487)
    at timer (zone.js:2281)

Note that this happens before any requests are made to server to retrieve data.
Angular component :
export class MyComponent implements OnInit {
public data: DataManager;

  ngOnInit(): void {
    this.data = new DataManager({
      url: "api/orders",
      adaptor: new WebApiAdaptor(),
      offline: true
    });
  }

  actionFailure(e: any): void {
    console.log(e.error);
  }
}

Angular component HTML:
<ejs-grid [dataSource]="data" (actionFailure)='actionFailure($event)'>
  <e-columns>
    <e-column field="id" headerText="Order ID" textAlign="Right" width="120"></e-column>
    <e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
    <e-column field='ShipCity' headerText='Ship City' width=150></e-column>
    <e-column field='ShipName' headerText='Ship Name' width=150></e-column>
  </e-columns>
</ejs-grid>

Can you help me with this please?

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team March 18, 2019 08:39 AM UTC

Hi Rami, 

Greetings from Syncfusion. 

Query: I'm getting the following error using grid and asp.net core web api 
ERROR TypeError: Cannot read property 'indexOf' of undefined 

We have analyzed your query but we are unable to reproduce the reported issue at our end. Please provide the below mentioned details, it will be helpful for us to provide a better solution asap. 

  1. Grid package version details?
  2. Full grid code example(including server side code)?
  3. Please try to reproduce the reproduce the reported issue in below attached sample if possible?


Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon