update()

in sample/frontend/src/app/financial-grid/financial-grid.service.ts [86:123]


  update(row: Row<any>, column: Column, update: any) {
    if (ColumnHelper.getColumnValue(row.data, column.columnDef) === update) {
      return;
    }
    let method: string;
    let updateInfo: any;
    switch (column.columnDef.field) {
      case 'accountType':
        updateInfo = {'accountTypeId': update.id};
        method = 'updateAccountTable'
        break;
      case 'transactionType':
        updateInfo = {'transactionTypeId': update.id};
        method = 'updateTransaction'
        break;
      default:
        updateInfo = {
          [column.columnDef.field]: update
        };
    }
    ColumnHelper.setColumnValue(row.data, column.columnDef, update);
    switch (row.rowLevel) {
      case 0:
        method = 'updateUser';
        break;
      case 1:
        method = 'updateAccount';
        break;
      case 2:
        method = 'updateTransaction';
        break;
    }
    this.businessService[method](row.data.id, updateInfo)
      .toPromise()
      .then(() => {
        this.gridEngine.filter();
      })
  }