【问题标题】:How do I execute some instructions after call refreshcells() from agGrid?从 agGrid 调用 refreshcells() 后如何执行一些指令?
【发布时间】:2020-04-16 21:54:52
【问题描述】:

这个功能是一个承诺

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

我如何让这个承诺生效?

【问题讨论】:

    标签: ag-grid ag-grid-angular


    【解决方案1】:

    只需返回您从refreshCells 收到的承诺,一切都会正常。

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

    它不起作用的原因是因为 verifyEdit 正在返回 void,而您期望 then

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-16
      • 2014-09-09
      • 1970-01-01
      • 1970-01-01
      • 2018-06-13
      • 2020-08-29
      • 2012-05-17
      相关资源
      最近更新 更多