Babs Mutabakat
Babs 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();
}
};
console.log('çalıştııı', this);
let rowCount = 0;
const accountGrid = this.allGrids['account-babs-balance-agreement-detail-company'];
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.COMPANYID_NAME.disable();
} else {
this.recordService.formGroup.controls.COMPANYID_NAME.enable();
}
}
} catch (e) {
console.error('accountGrid nulll', e);
}
/*try {
if (!stockGrid) {
throw new Error('grid null');
} else {
let rowCount = 0;
stockGrid.agGrid.api.forEachNode((rowNode) => {
rowCount++;
});
console.log('stockGrid', stockGrid);
if (
this.recordService.component.mode.value === 'update' &&
rowCount != 0
) {
this.recordService.formGroup.controls.BRANCHIDS.disable();
} else {
this.recordService.formGroup.controls.BRANCHIDS.enabled();
}
}
await awaitIf(() => stockGrid.grid && stockGrid.grid.agGrid);
} catch (e) {
console.error('account-babs-balance-agreement-detail-company', e);
}*/
})();
Last updated