Constructor
new Grid(selector, template, optionsopt)
Creates a new grid instance.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
selector |
String | jQuery selector. | |
template |
String | The template selector. | |
options |
Object |
<optional> |
The options object to apply to the grid. |
Methods
(static) count() → {Number}
Returns the number of documents currently in the grid.
Returns:
- Type
- Number
(static) db(dbopt) → {*}
Gets / sets the db instance this class instance belongs to.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
db |
Db |
<optional> |
The db instance. |
Returns:
- Type
- *
(static) drop() → {boolean}
Drops a grid and all it's stored data from the database.
Returns:
True on success, false on failure.
- Type
- boolean
(static) from(collection) → {Grid}
Sets the collection from which the grid will assemble its data.
Parameters:
Name | Type | Description |
---|---|---|
collection |
Collection | The collection to use to assemble grid data. |
Returns:
- Type
- Grid
(static) insert()
Executes an insert against the grid's underlying data-source.
(static) name(valopt) → {Grid}
Gets / sets the current name.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
val |
String |
<optional> |
The name to set. |
Returns:
- Type
- Grid
(static) refresh()
Refreshes the grid data such as ordering etc.
(static) remove()
Executes a remove against the grid's underlying data-source.
(static) state(valopt) → {Grid}
Gets / sets the current state.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
val |
String |
<optional> |
The name of the state to set. |
Returns:
- Type
- Grid
(static) template(template) → {*}
Gets / sets the grid's HTML template to use when rendering.
Parameters:
Name | Type | Description |
---|---|---|
template |
Selector | The template's jQuery selector. |
Returns:
- Type
- *
(static) update()
Executes an update against the grid's underlying data-source.
(static) updateById()
Executes an updateById against the grid's underlying data-source.