I'm basing on latest docs: https://www.telerik.com/kendo-angular-ui/components/grid/columns/auto-generated/
<kendo-grid [kendoGridBinding]="elements" ...some props>
<kendo-grid-column *ngFor="let column of elementsMeta"
field="{{column.name}}"
title="{{column.name}}">
<ng-template kendoGridCellTemplate let-dataItem>
<div>
{{ column.name }}
{{ dataItem[column.name] }}
</div>
</ng-template>
</kendo-grid-column>
</kendo-grid>
I have a list of metadata containing the dynamic columns name, I'm trying to iterate the col names according to the angular-kendo API in order to represent the actual data. (just like in the example).
when printing {{ column.name }} I see the key name of each column, when printing: {{ dataItem | json }} I can see model from it I want the evaluation of [column.name] be taken, I'm not sure why when trying to eveal both {{ dataItem[column.name] }} I'm not getting anything, is it an angular template limitation? did anyone manage to do so? must my current col definition model contain a 'type' field?
will appreciate any working - non-hackish - example :)
BTW I also tried following approach:
<ng-container *ngFor="let column of elementsMeta">
<kendo-grid-column field="{{column.field}}"
title="{{column.title}}">
<ng-template kendoGridCellTemplate let-dataItem>
{{ dataItem | json }} <br>
{{ dataItem[column.field] }} <br>
{{ column.field }}
</ng-template>
</kendo-grid-column>
</ng-container>
won't work as well :(
I'm running angular 6, with webpack and ngUpgrade config, compiling JIT, no cli involve, maybe the compiler havng an hard time with the double evaluation? dataItem[column.field]
not sure what to do..
{{ dataItem[column.field] }}
to the cell-template to the sample from the docs it works just fine. – PhilippOnPush
? – ShaidataItem
from and where do you getelementsMeta
from and when? – Shai