使用按钮单击事件,销毁 ag-grid
Using a button click event, destroy the ag-grid
使用普通的旧 javascript 版本的 ag-grid。
我想通过按钮单击事件销毁 div 中的农业网格。
如何破坏网格?
有一个名为 destory()
的方法。
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,还会处理内存泄漏。
使用普通的旧 javascript 版本的 ag-grid。
我想通过按钮单击事件销毁 div 中的农业网格。
如何破坏网格?
有一个名为 destory()
的方法。
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,还会处理内存泄漏。