这可能更像是一个角度问题,但我试图在加载数据(并动态显示/隐藏列)后调整清晰度数据网格的大小,但我一直收到错误
未捕获的类型错误:无法读取未定义的属性“调整大小”
组件.html
<clr-datagrid #contactsGrid>
[...]
</clr-datagrid>
组件.ts
import { Component, OnInit, ViewChild } from '@angular/core';
import { Datagrid } from "clarity-angular";
export class GridComponent implements OnInit {
@ViewChild('contactsGrid') datagrid: Datagrid;
//@ViewChild('Datagrid') datagrid: Datagrid; //This doesn't work either
constructor( ) { }
ngOnInit() {
[...]
this.datagrid.resize(); //this.datagrid is undefined
}
}