aurelia-ui-toolkits / aurelia-syncfusion-bridge

27 stars 21 forks source link

Dynamically set ejGrid columns #79

Closed atoninelli closed 6 years ago

atoninelli commented 6 years ago

Hi. I need to add dynamically the columns in an aurelia project (aurelia-syncfusion-bridge). Currently the static definition of the grid is (.html file):

<ej-grid id="Grid" e-data-source.bind="ejDataManager" e-allow-paging=true e-allow-sorting=true >
       <ej-column e-field="select" e-width="150" e-header-text="" e-template.bind="template" e-text-align="center"></ej-column>
</ej-grid>

And the .ts code that defines ejDataManager is:

this.ejDataManager = new ej.DataManager({ url: this.config.get('api.searchDocumentsEndpoint') });

Thanks for your help.

atoninelli commented 6 years ago

Solved my issue by defining the columns of the grid dynamically, such as:

<ej-grid id="Grid" ... e-columns.bind="columns">

and this.columns.push({ field: "RecordId", .... }); in the activate() method of the viewmodel class