Skip to content

Add data at run time. #5

Description

@coolvijaymca

Trying to configure data at run time but data is not displaying. at starting data is blank.

`hoursData: any[] = [];
configs: any = {
'group_by': 'type',
'group_by_header': 'Product Type',
'group_by_width': '100px',
'columns': [{
'header': 'Product Name',
'name': 'name',
'sortable': false
}, {
'header': 'Price',
'name': 'price',
'width': '200px',
'group_aggregator': (array) => {
const prices = array.map((item) => item.price);
return '$' + prices.reduce((acc, item) => acc + item);
}
}]
};

    var i = 1;
    for (const value of iPlanned) {
      let restallx = { type: 'Planned', name: value.Month, price: value.Hours };
      i++;
      this.hoursData.push(restallx);
    }
    i = 1;
    for (const value of iEstimated) {
      let restallx = { type: 'Estimated', name: value.Month, price: value.Hours };
      i++;
      this.hoursData.push(restallx);
    }
    i = 1;
    for (const value of iActual) {
      let restallx = { type: 'Actual', name: value.Month, price: value.Hours };
      i++;
      this.hoursData.push(restallx);
    }
    this.angularGrid.store.setRawData(this.hoursData);
    this.angularGrid.store.processData(null, null, null, null);
    this.angularGrid.store.refreshDisplayData();
    this.angularGrid.expandAll();`

Data is available in array however not displayed. Console displayed 'ngtreegrid.js:327 Data should not be empty!'

Can you tell us how to refresh data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions