ChemPal Documentation - v0.0.0
    Preparing search index...

    Interface CustomColumn<TData, TValue>

    Extended column interface with additional metadata support. Used to enhance TanStack Table columns with custom metadata.

    // Example column with range filter metadata
    const column: CustomColumn<Product, number> = {
    id: "price",
    header: "Price",
    accessorKey: "price",
    columnDef: {
    meta: {
    filterVariant: "range",
    rangeValues: [0, 1000]
    }
    }
    };
    interface CustomColumn<TData extends RowData, TValue = unknown> {
        columnDef: { meta?: any };
        getVisibleUniqueValues: () => (string | number)[];
        getVisibleRange: () => [number, number];
        getAllUniqueValues: () => (string | number)[];
        getFullRange: () => [number, number];
        getHeaderText: () => undefined | string;
        setFilterValueDebounced: (value: TValue) => void;
        setFilterValueThrottled: (value: TValue) => void;
        setColumnVisibility: (visible: boolean) => void;
        userSettings?: any;
    }

    Type Parameters

    • TData extends RowData

      The type of data in the table rows

    • TValue = unknown

      The type of value in the column cells

    Hierarchy

    Index

    Properties

    columnDef: { meta?: any }

    Extended column definition including metadata

    Type declaration

    • Optionalmeta?: any

      Additional column configuration metadata

    getVisibleUniqueValues: () => (string | number)[]

    Returns a sorted array of unique values from the currently visible rows in the column. This excludes values from rows that are filtered out by other column filters.

    Type declaration

      • (): (string | number)[]
      • Returns (string | number)[]

        Array of unique string or number values, sorted in ascending order

    getVisibleRange: () => [number, number]

    Returns the minimum and maximum values from the currently visible rows in the column. This excludes values from rows that are filtered out by other column filters.

    Type declaration

      • (): [number, number]
      • Returns [number, number]

        Tuple containing [min, max] values

    getAllUniqueValues: () => (string | number)[]

    Returns a sorted array of all unique values in the column, regardless of current filters.

    Type declaration

      • (): (string | number)[]
      • Returns (string | number)[]

        Array of unique string or number values, sorted in ascending order

    getFullRange: () => [number, number]

    Returns the minimum and maximum values from all rows in the column, regardless of current filters.

    Type declaration

      • (): [number, number]
      • Returns [number, number]

        Tuple containing [min, max] values

    getHeaderText: () => undefined | string

    Returns the display text of the column header. Handles cases where the header might be a string, function, or React element.

    Type declaration

      • (): undefined | string
      • Returns undefined | string

        The header text as a string, or undefined if no header text is available

    setFilterValueDebounced: (value: TValue) => void

    Sets the filter value for the column with a 500ms debounce. Useful for text input filters to prevent excessive filtering operations.

    Type declaration

      • (value: TValue): void
      • Parameters

        • value: TValue

          The new filter value to set

        Returns void

    setFilterValueThrottled: (value: TValue) => void

    Sets the filter value for the column with a 500ms throttle. Useful for range filters to limit the frequency of filter updates.

    Type declaration

      • (value: TValue): void
      • Parameters

        • value: TValue

          The new filter value to set

        Returns void

    setColumnVisibility: (visible: boolean) => void

    Sets the visibility of the column.

    Type declaration

      • (visible: boolean): void
      • Parameters

        • visible: boolean

          Whether the column should be visible

        Returns void

    userSettings?: any

    User settings associated with this column