从 agGrid 调用 refreshcells() 后如何执行一些指令?



这个函数是一个承诺

veryfyEdit()
this.gridApi.stopEditing()
this.gridApi.refreshCells() as Promise<any>
}

我在这里使用它并且返回未定义,但我需要知道如何通过此网格 API 使其工作

openLancarDialog() {
this.veryfyEdit().then(() => {
if (this.validadeData()) {
const dialogRef = this._lancarDialog.open(LancarCdvDialogComponent, {
width: '50em',
//height: '40em',
disableClose: false,
data: {
tipoViagem: this.dadosCab.tipoViagem,
empresaViagem: this.dadosCab.codEmpresa,
centroCustoViagem: this.dadosCab.area,
numeroCDV: this.dadosCab.numeroCDV,
dtoToSave: this.dtoToSave
}
});
dialogRef.afterClosed().subscribe(result => {
if (result != null && result != undefined)
this.showNotification(result.typeMsg, result.resultMsg)
if ((result == undefined) || (result.typeMsg === 'success')) {
this.Accesst('ctrl-despesas-viagens', 'listar-cdv');
}
});
}
})
}

我如何使这个承诺有效?

只需返回您从refreshCells那里收到的承诺,一切都应该会正常进行。

veryfyEdit()
this.gridApi.stopEditing()
return this.gridApi.refreshCells() as Promise<any>;
}

它不起作用的原因是因为verifyEdit返回了您期望thenvoid

最新更新