hjalmers / angular-generic-table

A generic table for Angular 2+. Generic table uses standard markup for tables ie. table, tr and td elements etc. and has support for expanding rows, global search, filters, sorting, pagination, export to CSV, column clicks, custom column rendering, custom export values.
https://hjalmers.github.io/angular-generic-table/
MIT License
104 stars 55 forks source link

Render method not working #195

Closed avril-verhaeghen closed 6 years ago

avril-verhaeghen commented 6 years ago

I'm having an issue with version 4.8.0. I initialised data of GtConfig with an empty array, insert data later within a Promise but still renders nothing, not even going in the render function (console log in it and doesn't log).

My code in the constructor:

this.gtConfig = {
      settings: [
        {
          objectKey: 'name',
          sort: 'asc',
          columnOrder: 0
        }, {
          objectKey: 'priority',
          sort: 'asc',
          columnOrder: 1
        }
      ],
      fields: [
        {
          name: 'Name',
          objectKey: 'name'
        }, {
          name: 'Prioriteit',
          objectKey: 'priority',
          render: () => 'hello'
        }
      ],
      data: []
    };

Then I trigger a "getData" method in ngOnInit

private _getData() {
    this.myService.getNames().then(data => {
      this.gtConfig.data = data['content'];
    });
  }

Data is array containing the objects for the table.

Anyone got some suggestions?

For info, I use the same exact method in another page of the same app and there it renders correctly.