ASP.NET MVC Controls | ComponentOne
In This Topic
    ICollectionView Interface
    In This Topic
    File
    wijmo.js
    Module
    wijmo.collections
    Implements
    INotifyCollectionChanged

    Enables collections to have the functionalities of current record management, custom sorting, filtering, and grouping.

    This is a JavaScript version of the ICollectionView interface used in Microsoft's XAML platform. It provides a consistent, powerful, and MVVM-friendly way to bind data to UI elements.

    Wijmo includes several classes that implement ICollectionView. The most common is CollectionView, which works based on regular JavsScript arrays.

    Properties

    Methods

    Properties

    canFilter

    Gets a value that indicates whether this view supports filtering via the filter property.

    Type
    boolean

    canGroup

    Gets a value that indicates whether this view supports grouping via the groupDescriptions property.

    Type
    boolean

    canSort

    Gets a value that indicates whether this view supports sorting via the sortDescriptions property.

    Type
    boolean

    currentChanged

    Occurs after the current item changes.

    Type
    EventArgs>

    currentChanging

    Occurs before the current item changes.

    Type
    wijmo.Event

    currentItem

    Gets the current item in the view.

    Type
    T

    currentPosition

    Gets the ordinal position of the current item in the view.

    Type
    number

    filter

    Gets or sets a callback used to determine if an item is suitable for inclusion in the view.

    NOTE: If the filter function needs a scope (i.e. a meaningful 'this' value), then remember to set the filter using the 'bind' function to specify the 'this' object. For example:

    collectionView.filter = this._filter.bind(this);
    
    Type
    IPredicate

    groupDescriptions

    Gets a collection of GroupDescription objects that describe how the items in the collection are grouped in the view.

    Type
    ObservableArray

    groups

    Gets the top-level groups.

    Type
    any[]

    isEmpty

    Gets a value that indicates whether this view contains no items.

    Type
    boolean

    items

    Gets the filtered, sorted, grouped items in the view.

    Type
    T[]

    sortDescriptions

    Gets a collection of SortDescription objects that describe how the items in the collection are sorted in the view.

    Type
    ObservableArray

    sourceCollection

    Gets or sets the collection object from which to create this view.

    Type
    any

    Methods

    beginUpdate

    beginUpdate(): void
    

    Suspends refreshes until the next call to endUpdate.

    Returns
    void

    contains

    contains(item: T): boolean
    

    Returns a value that indicates whether a given item belongs to this view.

    Parameters
    • item: T

      The item to locate in the collection.

    Returns
    boolean

    deferUpdate

    deferUpdate(fn: Function, force?: boolean): void
    

    Executes a function within a beginUpdate/endUpdate block.

    The collection will not be refreshed until the function has been executed. This method ensures endUpdate is called even if the function throws.

    Parameters
    • fn: Function

      Function to be executed within the beginUpdate/endUpdate block.

    • force: boolean
    Optional

    Whether to force a refresh when ending the update.

    Returns
    void

    endUpdate

    endUpdate(force?: boolean): void
    

    Resumes refreshes suspended by a call to beginUpdate.

    Parameters
    Optional

    Whether to force a refresh when ending the update.

    Returns
    void

    moveCurrentTo

    moveCurrentTo(item: T): boolean
    

    Sets the specified item to be the current item in the view.

    Parameters
    Returns
    boolean

    moveCurrentToFirst

    moveCurrentToFirst(): boolean
    

    Sets the first item in the view as the current item.

    Returns
    boolean

    moveCurrentToLast

    moveCurrentToLast(): boolean
    

    Sets the last item in the view as the current item.

    Returns
    boolean

    moveCurrentToNext

    moveCurrentToNext(): boolean
    

    Sets the item after the current item in the view as the current item.

    Returns
    boolean

    moveCurrentToPosition

    moveCurrentToPosition(index: number): boolean
    

    Sets the item at the specified index in the view as the current item.

    Parameters
    Returns
    boolean

    moveCurrentToPrevious

    moveCurrentToPrevious(): boolean
    

    Sets the item before the current item in the view as the current item.

    Returns
    boolean

    refresh

    refresh(): void
    

    Re-creates the view using the current sort, filter, and group parameters.

    Returns
    void