Is there a high-level Ag-Grid event to listen to any change to column state?

醉酒当歌 提交于 2019-12-24 08:03:16

问题


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?


回答1:


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);
        }
    });
}


来源:https://stackoverflow.com/questions/54823776/is-there-a-high-level-ag-grid-event-to-listen-to-any-change-to-column-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!