Hesap Mutabakatı

Hesap Mutabakatı Script

 (async () => {
  const awaitIf = async (fn, ms = 100) => {
    let result = false;
    while (!result) {
      try {
        result = fn();
      } catch (e) {
        console.error(e);
      }
      if (!result) await rxjs.timer(ms).toPromise();
    }
  };
  
  let rowCount = 0;
  const accountGrid = this.allGrids['account-balance-agreement-detail'];
  await awaitIf(() => accountGrid.grid && accountGrid.grid.agGrid);
  await awaitIf(() => accountGrid.grid && accountGrid.grid.agGrid);
  await awaitIf(() => accountGrid.grid && accountGrid.grid.agGrid);
  await accountGrid.grid.gridShareds.onRowLoad
    .pipe(rxjs.first((x) => x))
    .toPromise(); //grid data yüklenene kadar bekle
  accountGrid.api.forEachNode((rowNode) => {
    rowCount++;
  });

  try {
    if (!accountGrid) {
      throw new Error('accountGrid null');
    } else {
      console.log('rowCount', rowCount);
      if (rowCount != 0) {
        this.recordService.formGroup.controls.BRANCHIDS.disable();
      } else {
        this.recordService.formGroup.controls.BRANCHIDS.enable();
      }
    }
  } catch (e) {
    console.error('accountGrid nulll', e);
  }

})();

Last updated