gpt4 book ai didi

ag-grid - 使用按钮单击事件,销毁 ag-grid

转载 作者:行者123 更新时间:2023-12-01 10:23:17 26 4
gpt4 key购买 nike

使用简单的旧 javascript 版本的 ag-grid。

我想从按钮单击事件中销毁 div 中的 ag-grid。

我如何破坏网格?

最佳答案

有一个名为 destory() 的方法.

As per documentation:

destroy()
Gets the grid to destroy and release resources. If you are using Angular (version 1 or 2) you do not need to call this, as the grid links in with the AngularJS 1.x lifecycle. However if you are using Web Components or native Javascript, you do need to call this, to avoid a memory leak in your application.



看看 Plunk - Destroy grid 我创建。
gridOptions.api.destroy();

如您所见,通过调用此函数,网格会被破坏。
如文档中所述,它不仅会清除 DOM,还会处理内存泄漏。

关于ag-grid - 使用按钮单击事件,销毁 ag-grid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49077836/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com