How to expand row from datatable programmatically

后端 未结 5 674
被撕碎了的回忆
被撕碎了的回忆 2021-01-13 10:41

I want to expand row directly from an typescript method, i\'ve try with @viewchild but it doesn\'t work :

HTML:



        
5条回答
  •  伪装坚强ぢ
    2021-01-13 11:13

    There is a property expandedRows that is an array of all current expanded rows. You should be able to add / remove your row to this list to toggle row expansion.

    You will need to have:

    
    

    and

    expandedItems: Array = new Array();
    // expand row
    this.expandedItems.pop(this.gridData[rownumber]);
    // hide row
    this.expandedItems.push(this.gridData[rownumber]);
    

    Simple plunker but you get the idea... https://plnkr.co/edit/Zra8UUMv4XQCv0lbRbMg?p=preview

提交回复
热议问题