Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NgTableParams<T>

Parameters manager for an ngTable directive

Type parameters

  • T

Hierarchy

Index

Constructors

constructor

Properties

Private _settings

_settings: ISettings<T> = this.defaultSettings

data

data: T[] = []

The page of data rows currently being displayed in the table

Private defaultSettings

defaultSettings: ISettings<T> = NgTableParams.ngTableSettings.createDefaults<T>()

Private errParamsMemento

errParamsMemento: Memento

Private initialEvents

initialEvents: Function[] = []

Private isCommittedDataset

isCommittedDataset: boolean = false

isNullInstance

isNullInstance: boolean

Private prevParamsMemento

prevParamsMemento: Memento

reloadPages

reloadPages: function

Type declaration

    • (): void
    • Returns void

Static Private $log

$log: ng1.ILogService

Static Private $q

$q: ng1.IQService

Static Private ngTableDefaults

ngTableDefaults: IDefaults

Static Private ngTableEventsChannel

ngTableEventsChannel: NgTableEventsChannel

Static Private ngTableSettings

ngTableSettings: NgTableSettings

Methods

count

  • count(): number
  • count(count: number)

Private createComparableParams

  • createComparableParams(): Memento

filter

  • Returns the current filter values used to restrict the set of data rows.

    Parameters

    • Optional trim: boolean

      supply true to return the current filter minus any insignificant values (null, undefined and empty string)

    Returns IFilterValues

  • Sets filter values to the filter supplied; any existing filter will be removed Changes to filter will cause isDataReloadRequired to return true and the current page to be set to 1

    Parameters

generatePagesArray

  • generatePagesArray(currentPage?: number, totalItems?: number, pageSize?: number, maxBlocks?: number): Array<IPageButton>
  • Generate array of pages. When no arguments supplied, the current parameter state of this NgTableParams instance will be used

    Parameters

    • Optional currentPage: number

      Which page must be active

    • Optional totalItems: number

      Total quantity of items

    • Optional pageSize: number

      Quantity of items on page

    • Optional maxBlocks: number

      Quantity of blocks for pagination

    Returns Array<IPageButton>

    Array of pages

group

  • Returns the current grouping used to group the data rows

    Returns Grouping

  • Sets grouping to the group supplied; any existing grouping will be removed. Changes to group will cause isDataReloadRequired to return true and the current page to be set to 1

    Parameters

  • Sets grouping to the field and sortDirection supplied; any existing grouping will be removed Changes to group will cause isDataReloadRequired to return true and the current page to be set to 1

    Parameters

    • field: string
    • Optional sortDirection: GroupSort
  • Sets grouping to the group supplied; any existing grouping will be removed. If sortDirection is supplied, this will be assigned to the sortDirection property of group Changes to group will cause isDataReloadRequired to return true and the current page to be set to 1

    Parameters

hasErrorState

  • hasErrorState(): boolean
  • Returns true when an attempt to reload the current parameter values have resulted in a failure. This method will continue to return true until the reload is successfully called or when the parameter values have changed

    Returns boolean

hasFilter

  • hasFilter(): boolean
  • Returns true if filter has significant filter value(s) (any value except null, undefined, or empty string), otherwise false

    Returns boolean

hasFilterChanges

  • hasFilterChanges(): boolean
  • Return true when a change to filters require the reload method to be run so as to ensure the data presented to the user reflects these filters

    Returns boolean

Private hasGlobalSearchFieldChanges

  • hasGlobalSearchFieldChanges(): boolean

hasGroup

  • hasGroup(): boolean
  • hasGroup(group: string | IGroupingFunc<T>, sortDirection?: string): boolean

isDataReloadRequired

  • isDataReloadRequired(): boolean
  • Return true when a change to this instance should require the reload method to be run so as to ensure the data rows presented to the user reflects the current state.

    Note that this method will return false when the reload method has run but fails. In this case hasErrorState will return true.

    The built-in ngTable directives will watch for when this function returns true and will then call the reload method to load its data rows

    Returns boolean

isSortBy

  • isSortBy(field: string, direction?: string): boolean
  • Returns true if sorting by the field supplied. Where direction supplied the field must also be sorted by that direction to return true

    Parameters

    • field: string
    • Optional direction: string

    Returns boolean

Private log

  • log(...args: any[]): void

orderBy

  • orderBy(): Array<string>
  • Returns sorting values in a format that can be consumed by the angular $orderBy filter service

    Returns Array<string>

page

  • page(): number
  • page(page: number)
  • Returns the index of the current "slice" of data rows

    Returns number

  • Sets the index of the current "slice" of data rows. The index starts at 1. Changing the page number will cause isDataReloadRequired to return true

    Parameters

    • page: number

parameters

Private parseGroup

reload

  • reload<TResult>(): IPromise<TResult[]>

Private runInterceptorPipeline

  • runInterceptorPipeline(fetchedData: ng1.IPromise): IPromise<any>

settings

  • Returns the settings for the table.

    Returns ISettings<T>

  • Sets the settings for the table; new setting values will be merged with the existing settings. Supplying a new dataset will cause isDataReloadRequired to return true and the ngTableEventsChannel to fire its datasetChanged event

    Parameters

sorting

  • Returns the current sorting used to order the data rows. Changes to sorting will cause isDataReloadRequired to return true

    Returns ISortingValues

  • Sets sorting values to the sorting supplied; any existing sorting will be removed. Changes to sorting will cause isDataReloadRequired to return true

    Parameters

  • Sets sorting to the field and direction supplied; any existing sorting will be removed

    Parameters

    • field: string
    • direction: string

total

  • total(): number
  • total(total: number)
  • Returns the count of the data rows that match the current filter

    Returns number

  • Sets settings().total to the value supplied. Typically you will need to set a total in the body of any custom getData function you supply as a setting value to this instance.

    example
    const tp = new NgTableParams({}, { getData: customGetData })
    function customGetData(params) {
         const queryResult = // code to fetch current data rows and total //
         params.total(queryResult.total);
         return queryResult.dataRowsPage;
    }
    

    Parameters

    • total: number

url

  • url(asString?: boolean): object
  • Returns the current parameter values uri-encoded. Set asString to true for the parameters to be returned as an array of strings of the form 'paramName=value' otherwise parameters returned as a key-value object

    Parameters

    • Optional asString: boolean

    Returns object

    • [name: string]: string

Static init

Object literals

Private _params

_params: object

count

count: number = 10

filter

filter: object

Type declaration

group

group: object

Type declaration

page

page: number = 1

sorting

sorting: object

Type declaration

Generated using TypeDoc