Type alias ValueSetter<T>

ValueSetter<T>: ((row, value) => boolean | void)

Type Parameters

  • T = any

    the row type

Type declaration

    • (row, value): boolean | void
    • Writes an edited value of a calculated column back into the row (ColumnDefIf.valueSetter). Without a setter a calculated column cannot be edited. Return false to reject the value.

      Parameters

      • row: T
      • value: unknown

      Returns boolean | void

      Example

      // "total" is price × quantity – editing the total changes the price
      const setTotal: ValueSetter<Item> = (row, value) => {
      const total = Number(value);
      if (!Number.isFinite(total) || !row.quantity) return false;
      row.price = total / row.quantity;
      };

      Since

      1.1.95