Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DatatableFactory

Registers Vuejs-Datatable components globally in VueJS.

example

import { DatatableFactory } from 'vuejs-datatable'; const myDatatableFactory = new DatatableFactory() .registerTableType( new TableType( 'my-table', {}) ) Vue.use( myDatatableFactory );

Hierarchy

  • DatatableFactory

Implements

  • PluginObject<void>

Index

Constructors

constructor

Properties

Private defaultTableType

defaultTableType: TableType<any, any[], any[], any[], any[]> = new TableType<any>( DEFAULT_DATATABLE )

The default table type to use if no other configuration was provided.

Private tableTypes

tableTypes: object

Registry of declared table types.

Type declaration

Private Optional vueInstance

vueInstance: undefined | VueConstructor<Vue>

A reference to the Vue instance the plugin is installed in. It may be used to check if the factory was already installed

Methods

deregisterTableType

  • deregisterTableType(nameOrTableType: string | TableType<any>): this
  • Creates a new table type with a specified prefix, that you can customize using a callback.

    Parameters

    • nameOrTableType: string | TableType<any>

      The name of the component to register, or a TableType object.

    Returns this

    this for chaining.

getTableType

  • getTableType(id?: string): TableType<any> | undefined
  • Get a table type by its identifier.

    Parameters

    • Default value id: string = DEFAULT_DATATABLE

      The identifier of the table type. If not provided, it will default to the default table type.

    Returns TableType<any> | undefined

    the table type registered with that identifier.

install

  • install(vue: VueConstructor): void
  • Declares global components exported by vuejs-datatable, & load configs.

    Parameters

    • vue: VueConstructor

    Returns void

    nothing.

Private installTableType

  • installTableType(id: string): this
  • Declares a pair of components (a Datatable & a Datatable-Pager) sharing a config.

    Parameters

    • id: string

      The base name of the datatable type.

    Returns this

    this for chaining.

registerTableType

  • registerTableType<TRow, TSource, TFiltered, TSorted, TPaged>(nameOrTableType: string | TableType<TRow, TSource, TFiltered, TSorted, TPaged>, callback?: undefined | function): this
  • Creates a new table type with a specified prefix, that you can customize using a callback.

    Type parameters

    • TRow: __type

    • TSource

    • TFiltered

    • TSorted

    • TPaged

    Parameters

    • nameOrTableType: string | TableType<TRow, TSource, TFiltered, TSorted, TPaged>

      The name of the component to register, or a TableType object.

    • Optional callback: undefined | function

      An optional function to execute, that configures the newly created TableType. It takes a single parameter: the newly created TableType, and should return the transformed table type.

    Returns this

    this for chaining.

Private uninstallTableType

  • uninstallTableType(id: string): this
  • Remove a table type definition from vue (the datatable & its associated pager). This should be used carefully, because Vue won't be able to instanciate new instances of this table type.

    Parameters

    • id: string

      The base name of the datatable type to forget.

    Returns this

    this for chaining.

useDefaultType

  • useDefaultType(use: boolean): this
  • useDefaultType(): boolean
  • Controls the use of the default table type.

    Parameters

    • use: boolean

      true to use the default type, false otherwise.

    Returns this

    this for chaining.

  • Check if the factory uses the default table type.

    Returns boolean

    a boolean indicating if the factory uses the default table type.

Generated using TypeDoc