How to initialize ag-grid api in angular2 application

前端 未结 3 1108
离开以前
离开以前 2021-01-14 19:00

I am working on an application built using angular2 with typescript. I am using ag-grid to display data in grid but not able to find the grid api.

/// 

        
3条回答
  •  再見小時候
    2021-01-14 19:29

    The above 'almost' got me there in ang 2 rc1 but I found i needed the Grid Options link in the html as well so

     
             
    

    and

    ngOnInit(){
         this.gridOptions = {
            onGridReady: () => {
                 this.gridOptions.api.sizeColumnsToFit();
             }
         };
     }
    

    this worked perfectly and the grid resized as the window moved. Thanks to dfsq as I would not have used the handy onGridReady either :)

提交回复
热议问题