nx.data.ObservableCollection - Next UI Toolkit

#

API Docs for: trial
Show: Inherited Protected Private Deprecated

# nx.data.ObservableCollection Class

Uses

- nx.Observable

Extends nx.data.Collection
Module: nx.data

- Index
- Methods
- Properties

## Item Index

### Methods

- add
- addRange
- calculate
- clear
- clearBinding
- contains
- dispose
- each
- getBinding
- getItem
- getRange
- indexOf
- insert
- insertRange
- lastIndexOf
- monitor
- notify
- remove
- removeAt
- select
- setBinding
- sort
- toArray
- toggle
- unwatch

### Properties

- count
- length

## Methods

### `add`

(

- `item`

)

Inherited from nx.data.Collection

Add an item.

#### Parameters:

- `item` Object

### `addRange`

(

- `iter`

)

Inherited from nx.data.Collection

#### Parameters:

- `iter` Object

### `calculate`

(

- `experssion`
- `sources`

)

Calculate and synchronize collection with a collection calculation.

#### Parameters:

- `experssion` Object
- `sources` Object

#### Returns:

resource for release the binding

### `clear`

()

Inherited from nx.data.Collection

### `clearBinding`

(

- `prop`

)

Inherited from nx.Observable:

Clear binding for specified property.

#### Parameters:

- `prop` Object

### `contains`

(

- `item`

)
Boolean

Inherited from nx.data.Collection:

#### Parameters:

- `item` Object

#### Returns:

Boolean:

### `dispose`

()

Inherited from nx.Observable:

Dispose current object.

### `each`

(

- `callback`
- `context`

)

Inherited from nx.Iterable

#### Parameters:

- `callback` Object
- `context` Object

### `getBinding`

(

- `prop`

)

Inherited from nx.Observable:

Get existing binding object for specified property.

#### Parameters:

- `prop` Object

#### Returns:

:

### `getItem`

(

- `index`

)

Inherited from nx.data.Collection:

#### Parameters:

- `index` Object

#### Returns:

:

### `getRange`

(

- `index`
- `count`

)
Collection

Inherited from nx.data.Collection:

#### Parameters:

- `index` Object
- `count` Object

#### Returns:

Collection:

### `indexOf`

(

- `item`

)

Inherited from nx.data.Collection:

Get the first index the given item appears in the collection, -1 if not found.

#### Parameters:

- `item` Object

#### Returns:

:

### `insert`

(

- `item`
- `index`

)

Inherited from nx.data.Collection

#### Parameters:

- `item` Object
- `index` Object

### `insertRange`

(

- `iter`
- `index`

)

Inherited from nx.data.Collection

#### Parameters:

- `iter` Object
- `index` Object

### `lastIndexOf`

(

- `item`

)

Inherited from nx.data.Collection:

#### Parameters:

- `item` Object

#### Returns:

:

### `monitor`

(

- `handler`

)

Apply a diff watcher, which handles each item in the collection, to the collection.

#### Parameters:

- `handler` Object

  lambda(item) returning a rollback method

#### Returns:

unwatcher A Object with unwatch method.

### `notify`

(

- `names`
- `oldValue`

)

Inherited from nx.Observable:

#### Parameters:

- `names` Object
- `oldValue` Object

### `remove`

(

- `item`

)

Inherited from nx.data.Collection

#### Parameters:

- `item` Object

### `removeAt`

(

- `index`

)

Inherited from nx.data.Collection

#### Parameters:

- `index` Object

### `select`

(

- `source`
- `conditions`
- `determinator`

)

Select a sub-collection from a source collection. Usage:

    // select all items from collection with property active==true
    resource = subCollection.select(collection, "active")
    // select all items from collection with path owner.name=="Knly"
    resource = subCollection.select(collection, "owner.name", function(name){
        return name==="Knly";
    });
    // select all string item from collection
    resource = subCollection.select(collection, function(item){
        return typeof item === "string";
    });

#### Parameters:

- `source` nx.data.ObservableCollection
- `conditions` String
- `determinator` Function

#### Returns:

resource for release the binding

### `setBinding`

(

- `prop`
- `expr`
- `source`

)

Inherited from nx.Observable:

Set binding for specified property.

#### Parameters:

- `prop` Object
- `expr` Object
- `source` Object

### `sort`

(

- `comp`

)

Inherited from nx.data.Collection

#### Parameters:

- `comp` Object

### ``

(

- `names`
- `handler`
- `context`

)

Inherited from nx.Observable:

#### Parameters:

- `names` Object
- `handler` Object
- `context` Object

### `toArray`

() Array

Inherited from nx.Iterable

#### Returns:

Array:

### `toggle`

(

- `item`

)

Inherited from nx.data.Collection:

Toggle item's existence.

#### Parameters:

- `item` Object

### `unwatch`

(

- `names`
- `handler`
- `context`

)

Inherited from nx.Observable:

#### Parameters:

- `names` Object
- `handler` Object
- `context` Object

## Properties

### `count`

Number

Inherited from nx.Iterable

### `length`

Number

Inherited from nx.data.Collection: