x4js - v2.3.33
    Preparing search index...

    Class DataStore<T>

    Type Parameters

    • T = any

    Hierarchy (View Summary)

    Index
    m_fields: FieldInfo[]
    m_model: DataModel<T>
    m_proxy: DataProxy
    m_rec_index: DataIndex
    m_records: DataRecord<T>[]
    • Registers an event listener for a specific event name.

      Type Parameters

      • K extends "data_change"

      Parameters

      • name: K

        The name of the event to listen for (must be a key in E).

      • callback: (ev: DataStoreEventMap[K]) => void

        The function to be called when the event is fired.

      • capturing: boolean = false

        If true, the listener will be added to the beginning of the listener list (capturing phase).

      Returns () => void

    • Dispatches an event with a given name and payload to all registered listeners. A listener that throws: its error goes to console.error, the next listeners are called, and fire returns normally.

      Type Parameters

      • K extends "data_change"

      Parameters

      • name: K

        The name of the event to fire (must be a key in E).

      • evx: DataStoreEventMap[K]

        The event payload (event object) to pass to the listeners.

      Returns void

    • find the index of the element with the given id

      Parameters

      • id: any

      Returns number

    • Parameters

      • Optionalurl: string

      Returns Promise<void>

      the loading from an url is to be reviewed: load the data, then setData. Only for a store created with url and no data; an HTTP error is not reported

    • Removes a previously registered event listener.

      Type Parameters

      • K extends "data_change"

      Parameters

      • name: K

        The name of the event from which to remove the listener.

      • callback: (ev: DataStoreEventMap[K]) => any

        The specific callback function to remove. It must be the same function instance that was originally registered.

      Returns void

    • convert raw objects to real records from model

      Parameters

      • records: any[]

      Returns void