Welcome to the Angular feedback portal. We’re happy you’re here! If you have feedback on how to improve the Angular, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

Hi Support,


I am trying to use an observable as data source for a DataGrid as per instructions in 

https://ej2.syncfusion.com/angular/documentation/grid/observables/#using-observable-without-async-pipe


However, my service does not extend a Subject (or an Observable), so I cannot use the service itself as the data source, as it is done in the above example.

So, what I have to do is: on my dataStateChange event handler I call my service's data retrieval function (listOData) to update the grid data source.

But, even after the data is retrieved, the data source is not automatically refreshed. The action never completes and the grid remains showing its spinner.

I managed to work around this by setting the grid data source to null and, afterwards, setting it again to the service list method's response, as can be seen below:


    onDataStateChange(state: DataStateChangeEventArgs): void {
      this.service
        .listOData(state)
        .pipe(
          first(),
          tap((resp: any) => {
            this.gridEntities.dataSource = null;
            this.gridDataSource = resp;
            this.gridEntities.dataSource = this.gridDataSource;
          })
        )
        .subscribe();
    }



However, I understand this should not be necessary.

Notice this issue only happens when the grid's data source is updated inside the result block of a function which returns an Observable (i.e., inside a tap, map or a subscribe block, for instance). If I update it directly inside the dataStateChange event handler, it works fine. However, this is not an option, in my scenario.


Please let me know if further info is required.


Best regards,

Marco.