I'm using angular 10 with kendo, now I have the problem with export excel from kendo grid, I html can preview normally, but when export as excel it have no id field. here is my code
html
<kendo-grid [kendoGridBinding]="products" [height]="400">
<ng-template kendoGridToolbarTemplate>
<button type="button" kendoGridExcelCommand icon="file-excel">
Download Excel
</button>
</ng-template>
<kendo-grid-column title="id">
<ng-template kendoGridCellTemplate let-rowIndex="rowIndex">
{{ rowIndex + 1 }}
</ng-template>
</kendo-grid-column>
<kendo-grid-column field="pname" title="Product name"></kendo-grid-column>
<kendo-grid-excel fileName="Products.xlsx"></kendo-grid-excel>
</kendo-grid>
ts
import { Component } from '@angular/core';
import { aggregateBy } from '@progress/kendo-data-query';
import { productList } from './products';
@Component({
selector: 'my-app',
templateUrl: 'app.component.html'
})
export class AppComponent {
products = productList;
}
productList
export const productList = [
{ pname: 'Coca-Cola'},
{ pname: 'Sprite'},
{ pname: 'Pepsi'},
{ pname: 'Red Bull'},
{ pname: 'Fanta'},
{ pname: 'Olate'},
{ pname: 'Boos-trong'},
{ pname: 'Karabao'},
{ pname: 'M150'}
];
and here is my code in stackbiz
Please help to solve this problem, Thank in advance.
Copyright Notice:Content Author:「Traly」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/65786408/kendo-grid-for-angular-cannot-export-index-column-to-excel