Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data at run time. #5

Open
coolvijaymca opened this issue Oct 8, 2020 · 2 comments
Open

Add data at run time. #5

coolvijaymca opened this issue Oct 8, 2020 · 2 comments

Comments

@coolvijaymca
Copy link

coolvijaymca commented Oct 8, 2020

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.

@debabratapatra
Copy link
Owner

debabratapatra commented Oct 9, 2020

Have you tried this.hoursData = updatedData?

@coolvijaymca
Copy link
Author

coolvijaymca commented Oct 12, 2020

I did, I even tried this.angularGrid.data = updatedData; but no result. This should replace previous data with new data but not did the work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants