ASP.NET MVC Controls
ObservableArray Class
File
wijmo.js
Module
wijmo.collections
Base Class
ArrayBase
Derived Classes
RowColCollection, AxisCollection, PlotAreaCollection, SheetCollection, PivotFieldCollection
Implements
INotifyCollectionChanged

Array that sends notifications on changes.

The class raises the collectionChanged event when changes are made with the push, pop, splice, insert, or remove methods.

Warning: Changes made by assigning values directly to array members or to the length of the array do not raise the collectionChanged event.

Constructor

Properties

Methods

Events

Constructor

constructor

constructor(data?: any[]): ObservableArray

Initializes a new instance of the ObservableArray class.

Parameters
Returns
ObservableArray

Properties

isUpdating

Gets a value that indicates whether notifications are currently suspended (see beginUpdate and endUpdate).

Type

Methods

beginUpdate

beginUpdate(): void

Suspends notifications until the next call to endUpdate.

Returns
void

clear

clear(): void

Removes all items from the array.

Returns
void

deferUpdate

deferUpdate(fn: Function): void

Executes a function within a beginUpdate/endUpdate block.

The collection will not be refreshed until the function finishes. This method ensures endUpdate is called even if the function throws an exception.

Parameters
  • fn: Function

    Function to be executed without updates.

Returns
void

endUpdate

endUpdate(): void

Resumes notifications suspended by a call to beginUpdate.

Returns
void

implementsInterface

implementsInterface(interfaceName: string): boolean

Returns true if the caller queries for a supported interface.

Parameters
  • interfaceName: string

    Name of the interface to look for.

Returns
boolean

indexOf

indexOf(searchElement: any, fromIndex?: number): number

Searches for an item in the array.

Parameters
  • searchElement: any

    Element to locate in the array.

  • fromIndex: number Optional

    The index where the search should start.

Returns
number

insert

insert(index: number, item: any): void

Inserts an item at a specific position in the array.

Parameters
  • index: number

    Position where the item will be added.

  • item: any

    Item to add to the array.

Returns
void

onCollectionChanged

onCollectionChanged(e?: NotifyCollectionChangedEventArgs): void

Raises the collectionChanged event.

Parameters
Returns
void

push

push(...item: any[]): number

Adds one or more items to the end of the array.

Parameters
  • ...item: any[]

    One or more items to add to the array.

Returns
number

remove

remove(item: any): boolean

Removes an item from the array.

Parameters
  • item: any

    Item to remove.

Returns
boolean

removeAt

removeAt(index: number): void

Removes an item at a specific position in the array.

Parameters
  • index: number

    Position of the item to remove.

Returns
void

setAt

setAt(index: number, item: any): void

Assigns an item at a specific position in the array.

Parameters
  • index: number

    Position where the item will be assigned.

  • item: any

    Item to assign to the array.

Returns
void

slice

slice(begin?: number, end?: number): any[]

Creates a shallow copy of a portion of an array.

Parameters
  • begin: number Optional

    Position where the copy starts.

  • end: number Optional

    Position where the copy ends.

Returns
any[]

sort

sort(compareFn?: Function): any[]

Sorts the elements of the array in place.

Parameters
  • compareFn: Function Optional

    Specifies a function that defines the sort order. If specified, the function should take two arguments and should return -1, +1, or 0 to indicate the first argument is smaller, greater than, or equal to the second argument. If omitted, the array is sorted in dictionary order according to the string conversion of each element.

Returns
any[]

splice

splice(index: number, count: number, item?: any): any[]

Removes and/or adds items to the array.

Parameters
  • index: number

    Position where items will be added or removed.

  • count: number

    Number of items to remove from the array.

  • item: any Optional

    Item to add to the array.

Returns
any[]

Events

collectionChanged

Occurs when the collection changes.

Arguments
NotifyCollectionChangedEventArgs

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback