Function readLegacyState

  • Reads the state that tables before 1.1.92 stored under <key>sortingState, <key>scrollState and <key>collapsedExpandedState and converts it to a TableStateIf. The stored sort items hold a column INDEX – it is converted to the property of the column at that index in the default column order (the order a table of the old version always started with).

    Parameters

    • storage: StateStorageIf

      the storage

    • key: string

      the storage key of the table (getStorageKeyFn())

    • properties: string[]

      the properties of the columns in the default order

    Returns TableStateIf | undefined

    the state, undefined if nothing was stored

    Example

    localStorage.setItem("orderssortingState", '[{"columnIndex":2,"sortState":"desc"}]');
    readLegacyState(localStorage, "orders", ["id", "customer", "total"]);
    // → { version: 1, sort: [{ property: "total", sortState: "desc" }] }

    Since

    1.1.92