简体   繁体   中英

how to automatically expand detail in kendo grid for angular

I am having a problem with automatically expanding the details in kendo grid using angular. I want to be expanded details when datas load. I am using the ng-template kendoGridDetailTemplate. Is there any way to automatically expand detail?

I have tried using kendoGridCellTemplate just input text, but it can't load datas.

<kendo-grid [data]="boxList" > <kendo-grid-column field ="BOX_NO" title="box_no"> </kendo-grid-column> <ng-template kendoGridDetailTemplate let-dataItem> <p>{{dataItem.ETC}}</p> </kendo-grid>

I wanted them to show automatically expanded. Not clicking the button.

You can do something like that:

  1. In your code add a viewchild to be able to access the grid

     @ViewChild(GridComponent) private grid: GridComponent; 
  2. In the ngOnInit do the following

     for (let i = 0; i < this.boxList.length; i++){ this.grid.expandRow(i); } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM