是否有高层的Ag-Grid事件来监听列状态的任何变化? [英] Is there a high-level Ag-Grid event to listen to any change to column state?

查看:597
本文介绍了是否有高层的Ag-Grid事件来监听列状态的任何变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Ag-Grid与Angular一起使用,我想听听任何修改列状态的事件。



到目前为止,我必须列出所有事件:




  • (columnVisible)= onCol($ event)

  • (columnMoved)= onCol($ event)

  • 等。



我是否可以依靠通用事件或更高级别的事件来监听列状态的任何变化?

解决方案

有一个 addGlobalListener ,在此处



有一个示例: https://www.ag-grid.com/javascript-grid-column-definitions/ #column-api-example



以下是该示例的Angular版本中的相关代码:



< pre class = lang-js prettyprint-override > onGridReady(params){
this.gridApi = params.api;
this.gridColumnApi = params.columnApi;

params.api.addGlobalListener(function(type,event){
if(type.indexOf( column)> = 0){
console.log(得到了列事件:,event);
}
});
}


I use Ag-Grid together with Angular and I would like to listen to any event that modify column state.

As of now, I have to list all events:

  • (columnVisible)=onCol($event)
  • (columnMoved)=onCol($event)
  • etc.

Is there a generic or higher-level event I could rely on in order to listen to any change to column state?

解决方案

There's addGlobalListener, listed here.

There's an example: https://www.ag-grid.com/javascript-grid-column-definitions/#column-api-example

Here's the relevant code from the Angular version of the example:

onGridReady(params) {
    this.gridApi = params.api;
    this.gridColumnApi = params.columnApi;

    params.api.addGlobalListener(function(type, event) {
        if (type.indexOf("column") >= 0) {
            console.log("Got column event: ", event);
        }
    });
}

这篇关于是否有高层的Ag-Grid事件来监听列状态的任何变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆