@timlassiter11/yatl
    Preparing search index...

    Interface YatlTableApi<T>

    interface YatlTableApi<T extends object = UnspecifiedRecord> {
        columnOrder: NestedKeyOf<T>[];
        columns: ColumnOptions<T>[];
        columnStates: ColumnState<T>[];
        controller: YatlTableController<T>;
        data: T[];
        displayColumns: DisplayColumnOptions<T>[];
        editTrigger: YatlTableEditTrigger;
        emptyMessage: string;
        filters: Partial<{ [K in string]: unknown }> | null;
        filterStrategy: FilterCallback<T> | null;
        hideFooter: boolean;
        noResultsMessage: string;
        nullValuePlaceholder: string;
        readonly: boolean;
        reorderable: boolean;
        resizable: boolean;
        rowIdCallback?: RowIdCallback<T>;
        rowNumbers: boolean;
        rowParts: RowPartsCallback<T> | null;
        rowSelectionMethod: RowSelectionMethod | null;
        scoredSearch: boolean;
        searchQuery: string;
        searchTokenizer: TokenizerCallback;
        selectedRowIds: RowId[];
        sortable: boolean;
        storageOptions: StorageOptions | null;
        striped: boolean;
        tokenizedSearch: boolean;
        virtualScroll: boolean;
    }

    Type Parameters

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    columnOrder: NestedKeyOf<T>[]

    The explicit, raw visual layout intent for the table's columns. This property acts as the pure state record. It is strictly symmetrical: reading this property will return the exact array of field names that was most recently set, preserving the user's or developer's exact layout preference.

    • Use this property when exporting or saving the table's layout state (e.g., to localStorage or a database).
    • Note: Because this represents intent rather than computed reality, it may contain fields that are no longer defined, or omit newly added fields. If you need the exact array of columns currently rendered on the screen, use displayColumns instead.
    columns: ColumnOptions<T>[]

    The definitions for the columns to be rendered. This defines the field mapping, titles, sortability, and other static options.

    columnStates: ColumnState<T>[]

    The dynamic runtime state of the table's columns (visibility, width, and sort order).

    Unlike the static columns definitions, columnStates represents the current, interactive state of the grid. This is primarily used for programmatic control, or for saving and restoring user preferences (e.g., from localStorage).

    controller: YatlTableController<T>

    The table controller to use for this table component.

    data: T[]

    The array of data objects to be displayed. Objects must satisfy the WeakKey constraint (objects only, no primitives).

    displayColumns: DisplayColumnOptions<T>[]

    The computed, fully-resolved array of columns intended for visual rendering. This is a derived View Model. It takes the explicit columnOrder intent and reconciles it against the actual columns definitions. It safely handles newly added columns, filters out undefined fields, and guarantees a strictly-typed array representing the exact left-to-right visual layout of the data grid. This property is intended for template rendering and internal layout math (such as drag-and-drop boundary calculations). To programmatically mutate the column layout, set the columnOrder property or use the moveColumn() API.

    emptyMessage: string

    The message displayed when the data array is empty.

    filters: Partial<{ [K in string]: unknown }> | null

    An optional set of criteria to filter the visible rows. This runs before the global search query is applied. *

    // Shows rows where status is 'active' AND role is 'admin'
    table.filters = { status: 'active', role: 'admin' };
    filterStrategy: FilterCallback<T> | null

    An optional custom filter function. Provide this function to bypass the default filter logic.

    The current data record being evaluated.

    The original index of the row in the unfiltered dataset.

    The current active filter state (the filters object).

    true to keep the row in the filteredData results, false to exclude it.

    controller.filterStrategy = (row, filters) => {
    // Example: Custom global search across multiple columns
    if (filters.globalSearch) {
    const term = filters.globalSearch.toLowerCase();
    if (
    !row.firstName.toLowerCase().includes(term) &&
    !row.lastName.toLowerCase().includes(term)
    ) {
    return false;
    }
    }
    // Example: Strict mathematical matching
    if (filters.minAge && row.age < filters.minAge) {
    return false;
    }
    return true;
    };
    hideFooter: boolean

    Hides the built-in footer row which displays the current record count. The footer content can be customized using the slot="footer" element.

    noResultsMessage: string

    The message displayed when data exists but the current search/filter results in zero visible rows.

    nullValuePlaceholder: string

    The string to display in a cell when the data value is null or undefined.

    readonly: boolean

    When set, editing is completely disabled.

    reorderable: boolean

    Allows users to reorder columns by dragging and dropping headers.

    resizable: boolean

    Default resizability for all columns. Can be overridden by setting resizable on the specific column definition.

    NOTE: Changing this will not clear current column widths.

    rowIdCallback?: RowIdCallback<T>

    A callback function used to extract or generate a unique identifier for each row.

    A stable, unique ID is heavily relied upon by the grid engine for maintaining row selection state, tracking row metadata, and ensuring optimal rendering performance within the virtual scroller—especially when data is actively being sorted, filtered, or updated.

    Default Behavior: * If not provided, the table will automatically attempt to locate an id, key, or _id property on the row data object. If none are found, it falls back to using the row's original array index (which will trigger a console warning, as indices are inherently unstable during sorting).

    Note: Because this expects a JavaScript function, it is exposed strictly as a property and does not have a corresponding HTML attribute. You must use the property binding syntax (.rowIdCallback) in a Lit template.

    * <yatl-table .rowIdCallback=${(row) => row.deviceUuid}></yatl-table>
    
    // Programmatic assignment using a composite key
    table.rowIdCallback = (row, index) => `${row.chassisId}-${row.slotNumber}`;
    rowNumbers: boolean

    When set, shows a column to the left of each row with its row number.

    rowParts: RowPartsCallback<T> | null

    A callback function to conditionally apply CSS parts to table rows.

    rowSelectionMethod: RowSelectionMethod | null

    The row selection method to use.

    • single - Only a single row can be selected at a time
    • multi - Multiple rows can be selected at a time
    • null - Disable row selection

    row-selection-method

    scoredSearch: boolean

    Enables weighted relevance scoring for search results. When enabled, exact matches and prefix matches are ranked higher than substring matches. Rows are sorted by their relevance score descending.

    searchQuery: string

    The current text string used to filter the table data. Setting this property triggers a new search and render cycle.

    searchTokenizer: TokenizerCallback

    A function that splits the search query into tokens. Only used if search tokenization is enabled.

    whitespaceTokenizer
    
    selectedRowIds: RowId[]

    List of currently selected row indexes.

    • NOTE: These indexes are based off the of the original data array index, not the filtered data.
    sortable: boolean

    Default sortability for all columns. Can be overridden by setting sortable on the specific column definition.

    NOTE: Changing this will not clear sorted column states.

    storageOptions: StorageOptions | null

    Configuration options for automatically saving and restoring table state (column width, order, visibility, etc.) to the provided storage interface.

    striped: boolean

    Enables visual row striping

    tokenizedSearch: boolean

    Enables tokenized search behavior. When enabled, the search query is split into individual tokens using the searchTokenizer function (defaults to splitting on whitespace). A row is considered a match if ANY of the tokens appear in the searchable fields.

    virtualScroll: boolean

    When set, only the visible rows are rendered to the DOM, significantly improving performance for large datasets (1000+ rows).