Search Posts

How to return asyncronously return data from firebase to devextreme grid in angular 4

Good day, could you help me with the question?

I’m trying to receive data from firebase to devextreme component.
I’m using angular4.

Here is the code of my html page:

<dx-data-grid [dataSource]="priorities">
<dxi-column dataField="Priority"></dxi-column>
</dx-data-grid>

In the class of my component I receive the data from database this way:

ngOnInit() {

this.ds.list('priority').valueChanges().subscribe(
  data => {
    console.dir(data)
    for(var k = 0; k<data.length; k++){
      var prior = new priority();
      prior.Prioritie = data[k].toString();
      this.priorities.push(prior);
    }
    console.dir(this.priorities);}

where priorities is priorities: priority[] = [];

I receive the data from the database and create all the priotiry objects, but my devextreme component shows “No data”. What do I need to do to get it filled?

Source: AngularJS

Leave a Reply

Your email address will not be published. Required fields are marked *