ag-grid角度获取元素参考

无机的

如何在Angular的grid元素上获取DOM参考?似乎没有直接的方法。我试过了:

标记:

<ag-grid-angular #logGrid></ag-grid-angular>

ts:

@ViewChild('logGrid') logGrid: AgGridNg2;

AgGridNg2没有公开nativeElement或ElementRef属性。

我也尝试过:

@ViewChild('logGrid') logGrid: ElementRef;

它没有nativeElement属性,因为它的类型是AgGridNg2而不是ElementRef。

我需要DOM参考,因为ag-grid不公开其内容的scrollHeight

康纳斯·范

您可以通过将ViewChild装饰器read属性设置为来获得对该组件的host元素的引用ElementRef

@ViewChild('logGrid', { read: ElementRef }) logGridElementRef: ElementRef;

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章