# Class: OldView

## OldView

#### new OldView(viewName)

The view constructor.

##### Parameters:

Name | Type | Description
--- | --- | ---
`viewName` |  |

Source:
  - OldView.js, line 19

### Methods

- bind(selector, options)
- bindRender(bindSelector, domHandleropt)
- bindSortDom(selector, itemArr)
- count() → {Number}
- db(db) → {*}
- drop() → {boolean}
- find() → {*}
- from(collection) → {*}
- insert() → {*}
- isBound(selector) → {boolean}
- primaryKey() → {String}
- query(queryopt, refreshopt) → {*}
- queryAdd(obj, overwrite, refreshopt)
- queryData(queryopt, optionsopt, refreshopt) → {*}
- queryOptions(optionsopt, refreshopt) → {*}
- queryRemove(obj, refreshopt)
- refresh()
- remove() → {*}
- unBind(selector) → {Collection}
- update() → {*}

#### bind(selector, options)

Binds a selector to the insert, update and delete events of a particular view and keeps the selector in sync so that updates are reflected on the web page in real-time.

##### Parameters:

Name | Type | Description
--- | --- | ---
`selector` | String | The jQuery selector string to get target elements.
`options` | Object | The options object.

Source:
  - OldView.Bind.js, line 80

#### bindRender(bindSelector, domHandleropt)

Renders a bind view data to the DOM.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`bindSelector` | String |  | The jQuery selector string to use to identify the bind target. Must match the selector used when defining the original bind.
`domHandler` | function | <optional> | If specified, this handler method will be called with the final HTML for the view instead of the DB handling the DOM insertion.

Source:
  - OldView.Bind.js, line 189

#### bindSortDom(selector, itemArr)

Sorts items in the DOM based on the bind settings and the passed item array.

##### Parameters:

Name | Type | Description
--- | --- | ---
`selector` | String | The jQuery selector of the bind container.
`itemArr` | Array | The array of items used to determine the order the DOM elements should be in based on the order they are in, in the array.

Source:
  - OldView.Bind.js, line 115

#### count() → {Number}

Returns the number of documents currently in the view.

Source:
  - OldView.js, line 498

##### Returns:

Type
  Number

#### db(db) → {*}

Gets / sets the DB the view is bound against. Automatically set when the db.oldView(viewName) method is called.

##### Parameters:

Name | Type | Description
--- | --- | ---
`db` |  |

Source:
  - OldView.js, line 108

##### Returns:

Type
  *

#### drop() → {boolean}

Drops a view and all it's stored data from the database.

Source:
  - OldView.js, line 71

##### Returns:

True on success, false on failure.

Type
  boolean

#### find() → {*}

Queries the view data. See Collection.find() for more information.

Source:
  - OldView.js, line 506

##### Returns:

Type
  *

#### from(collection) → {*}

Gets / sets the collection that the view derives it's data from.

##### Parameters:

Name | Type | Description
--- | --- | ---
`collection` | * | A collection instance or the name of a collection to use as the data set to derive view data from.

Source:
  - OldView.js, line 123

##### Returns:

Type
  *

#### insert() → {*}

Inserts into view data via the view collection. See Collection.insert() for more information.

Source:
  - OldView.js, line 522

##### Returns:

Type
  *

#### isBound(selector) → {boolean}

Returns true if the selector is bound to the view.

##### Parameters:

Name | Type | Description
--- | --- | ---
`selector` | String | The jQuery selector string to identify the bind to check for.

Source:
  - OldView.Bind.js, line 105

##### Returns:

Type
  boolean

#### primaryKey() → {String}

Gets the primary key for this view from the assigned collection.

Source:
  - OldView.js, line 189

##### Returns:

Type
  String

#### query(queryopt, refreshopt) → {*}

Gets / sets the query being used to generate the view data.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`query` | Object | <optional> | The query to set.
`refresh` | Boolean | <optional> | Whether to refresh the view data after this operation. Defaults to true.

Source:
  - OldView.js, line 286

##### Returns:

Type
  *

#### queryAdd(obj, overwrite, refreshopt)

Add data to the existing query.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`obj` | Object |  | The data whose keys will be added to the existing query object.
`overwrite` | Boolean |  | Whether or not to overwrite data that already exists in the query object. Defaults to true.
`refresh` | Boolean | <optional> | Whether or not to refresh the view data set once the operation is complete. Defaults to true.

Source:
  - OldView.js, line 234

#### queryData(queryopt, optionsopt, refreshopt) → {*}

Gets / sets the query that the view uses to build it's data set.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`query` | Object | <optional> |
`options` | Boolean | <optional> | An options object.
`refresh` | Boolean | <optional> | Whether to refresh the view data after this operation. Defaults to true.

Source:
  - OldView.js, line 205

##### Returns:

Type
  *

#### queryOptions(optionsopt, refreshopt) → {*}

Gets / sets the query options used when applying sorting etc to the view data set.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`options` | Object | <optional> | An options object.
`refresh` | Boolean | <optional> | Whether to refresh the view data after this operation. Defaults to true.

Source:
  - OldView.js, line 307

##### Returns:

Type
  *

#### queryRemove(obj, refreshopt)

Remove data from the existing query.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`obj` | Object |  | The data whose keys will be removed from the existing query object.
`refresh` | Boolean | <optional> | Whether or not to refresh the view data set once the operation is complete. Defaults to true.

Source:
  - OldView.js, line 261

#### refresh()

Refreshes the view data and diffs between previous and new data to determine if any events need to be triggered or DOM binds updated.

Source:
  - OldView.js, line 324

#### remove() → {*}

Removed from view data via the view collection. See Collection.remove() for more information.

Source:
  - OldView.js, line 548

##### Returns:

Type
  *

#### unBind(selector) → {Collection}

Un-binds a selector from the view changes.

##### Parameters:

Name | Type | Description
--- | --- | ---
`selector` | String | The jQuery selector string to identify the bind to remove.

Source:
  - OldView.Bind.js, line 95

##### Returns:

Type
  Collection

#### update() → {*}

Updates into view data via the view collection. See Collection.update() for more information.

Source:
  - OldView.js, line 535

##### Returns:

Type
  *