ag-grid-vue 以编程方式订阅事件
ag-grid-vue subscribe to event programmatically
我正在尝试从 Vue 指令订阅 Ag-Grid
function insert(el: HTMLElement, binding: DirectiveBinding, {componentInstance} : VNode){
let grid = componentInstance as AgGridVue;
grid.$on('rowDataChanged', (params) => {
console.log(params) //Doesn't even enter to this event
})
grid.$on('row-data-changed', (params) => {
console.log(params) //Neither here
})
}
我只是想知道这是否可能。
于是,我通过调试大海捞针
let events = (componentInstance as any).gridOptions.api.eventService as EventService;
events.addEventListener('cellValueChanged', function (evt: CellValueChangedEvent) {
// Logic
})
我正在尝试从 Vue 指令订阅 Ag-Grid
function insert(el: HTMLElement, binding: DirectiveBinding, {componentInstance} : VNode){
let grid = componentInstance as AgGridVue;
grid.$on('rowDataChanged', (params) => {
console.log(params) //Doesn't even enter to this event
})
grid.$on('row-data-changed', (params) => {
console.log(params) //Neither here
})
}
我只是想知道这是否可能。
于是,我通过调试大海捞针
let events = (componentInstance as any).gridOptions.api.eventService as EventService;
events.addEventListener('cellValueChanged', function (evt: CellValueChangedEvent) {
// Logic
})