UNPKG

forerunnerdb

Version:

A NoSQL document store database for browsers and Node.js.

4,613 lines (1,147 loc) 57.7 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: View</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: View</h1> <section> <header> <h2> View </h2> </header> <article> <div class="container-overview"> <h4 class="name" id="View"><span class="type-signature"></span>new View<span class="signature">(name, query<span class="signature-attributes">opt</span>, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Creates a new view instance. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last">The name of the view.</td> </tr> <tr> <td class="name"><code>query</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The view's query.</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">An options object.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line22">line 22</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".isLinked"><span class="type-signature">(static) </span>isLinked<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Checks if the instance is data-bound to any DOM elements. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="AutoBind.js.html">AutoBind.js</a>, <a href="AutoBind.js.html#line566">line 566</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True if linked, false if not. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id=".link"><span class="type-signature">(static) </span>link<span class="signature">(outputTargetSelector, templateSelector, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="View.html">View</a>}</span></h4> <div class="description"> Data-binds the view data to the elements matched by the passed selector. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>outputTargetSelector</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last">The jQuery element selector to select the element into which the data-bound rendered items will be placed. All existing HTML will be removed from this element.</td> </tr> <tr> <td class="name"><code>templateSelector</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last">This can either be a jQuery selector identifying which template element to get the template HTML from that each item in the view's data will use when rendering to the screen, or you can pass an object with a template key containing a string that represents the HTML template such as: { template: '<div>{{:name}}</div>' }</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">An options object.wd</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="AutoBind.js.html">AutoBind.js</a>, <a href="AutoBind.js.html#line576">line 576</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>unlink</li> </ul> </dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="View.html">View</a></span> </dd> </dl> <h4 class="name" id=".unlink"><span class="type-signature">(static) </span>unlink<span class="signature">(outputTargetSelector, templateSelector)</span><span class="type-signature"> &rarr; {<a href="View.html">View</a>}</span></h4> <div class="description"> Removes a previously set-up data-binding via the link() method. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>outputTargetSelector</code></td> <td class="type"> <span class="param-type">Selector</span> </td> <td class="description last">The jQuery target selector.</td> </tr> <tr> <td class="name"><code>templateSelector</code></td> <td class="type"> <span class="param-type">Selector</span> </td> <td class="description last">The jQuery template selector.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="AutoBind.js.html">AutoBind.js</a>, <a href="AutoBind.js.html#line600">line 600</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>link</li> </ul> </dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="View.html">View</a></span> </dd> </dl> <h4 class="name" id="_chainHandler"><span class="type-signature">(private) </span>_chainHandler<span class="signature">(chainPacket)</span><span class="type-signature"></span></h4> <div class="description"> The chain reaction handler method for the view. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>chainPacket</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">The chain reaction packet to handle.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line323">line 323</a> </li></ul></dd> </dl> <h4 class="name" id="_collectionDropped"><span class="type-signature">(private) </span>_collectionDropped<span class="signature">(collection)</span><span class="type-signature"></span></h4> <div class="description"> Handles when an underlying collection the view is using as a data source is dropped. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>collection</code></td> <td class="type"> <span class="param-type"><a href="Collection.html">Collection</a></span> </td> <td class="description last">The collection that has been dropped.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line302">line 302</a> </li></ul></dd> </dl> <h4 class="name" id="_transformSetData"><span class="type-signature">(private) </span>_transformSetData<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Updates the public data object to match data from the private data object by running private data through the dataIn method provided in the transform() call. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line963">line 963</a> </li></ul></dd> </dl> <h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Returns the number of documents currently in the view. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line859">line 859</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id="data"><span class="type-signature"></span>data<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Gets the module's internal data collection. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line139">line 139</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id="distinct"><span class="type-signature"></span>distinct<span class="signature">(key, query<span class="signature-attributes">opt</span>, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Find the distinct values for a specified field across a single collection and returns the results in an array. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>key</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> </td> <td class="description last">The field path to return distinct values for e.g. "person.name".</td> </tr> <tr> <td class="name"><code>query</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The query to use to filter the documents used to return values from.</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The query options to use when running the query.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line493">line 493</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="drop"><span class="type-signature"></span>drop<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#boolean">boolean</a>}</span></h4> <div class="description"> Drops a view and all it's stored data from the database. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line510">line 510</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True on success, false on failure. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="global.html#boolean">boolean</a></span> </dd> </dl> <h4 class="name" id="emit"><span class="type-signature"></span>emit<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Emits an event. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line481">line 481</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Mixin.Events::emit()</li> </ul> </dd> </dl> <h4 class="name" id="ensureIndex"><span class="type-signature"></span>ensureIndex<span class="signature">()</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Creates an index on the view. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line314">line 314</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Collection::ensureIndex()</li> </ul> </dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="filter"><span class="type-signature"></span>filter<span class="signature">(query, func, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Executes a method against each document that matches query and returns an array of documents that may have been modified by the method. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>query</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last">The query object.</td> </tr> <tr> <td class="name"><code>func</code></td> <td class="type"> <span class="param-type"><a href="global.html#function">function</a></span> </td> <td class="attributes"> </td> <td class="description last">The method that each document is passed to. If this method returns false for a particular document it is excluded from the results.</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Optional options object.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line923">line 923</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="find"><span class="type-signature"></span>find<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Queries the view data. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line122">line 122</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Collection::find()</li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The result of the find query. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="findById"><span class="type-signature"></span>findById<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4> <div class="description"> Queries the view data by specific id. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line131">line 131</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Collection::findById()</li> </ul> </dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The result of the find query. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id="from"><span class="type-signature"></span>from<span class="signature">(source)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Sets the source from which the view will assemble its data. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>source</code></td> <td class="type"> <span class="param-type"><a href="Collection.html">Collection</a></span> | <span class="param-type"><a href="View.html">View</a></span> </td> <td class="description last">The source to use to assemble view data.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line149">line 149</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> If no argument is passed, returns the current value of from, otherwise returns itself for chaining. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="insert"><span class="type-signature"></span>insert<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Executes an insert against the view's underlying data-source. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line89">line 89</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Collection::insert()</li> </ul> </dd> </dl> <h4 class="name" id="off"><span class="type-signature"></span>off<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Cancels an event listener. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line473">line 473</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Mixin.Events::off()</li> </ul> </dd> </dl> <h4 class="name" id="on"><span class="type-signature"></span>on<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Listens for an event. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line465">line 465</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Mixin.Events::on()</li> </ul> </dd> </dl> <h4 class="name" id="orderBy"><span class="type-signature"></span>orderBy<span class="signature">(val<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Gets / sets the orderBy clause in the query options for the view. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The order object.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line694">line 694</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="page"><span class="type-signature"></span>page<span class="signature">(val<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Gets / sets the page clause in the query options for the view. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The page number to change to (zero index).</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line711">line 711</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="pageFirst"><span class="type-signature"></span>pageFirst<span class="signature">()</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Jump to the first page in the data set. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line731">line 731</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="pageLast"><span class="type-signature"></span>pageLast<span class="signature">()</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Jump to the last page in the data set. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line739">line 739</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="pageScan"><span class="type-signature"></span>pageScan<span class="signature">(val)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Move forward or backwards in the data set pages by passing a positive or negative integer of the number of pages to move. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last">The number of pages to move.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line752">line 752</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="primaryKey"><span class="type-signature"></span>primaryKey<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> Gets the primary key for this view from the assigned collection. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line502">line 502</a> </li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Collection::primaryKey()</li> </ul> </dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="privateData"><span class="type-signature"></span>privateData<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="Collection.html">Collection</a>}</span></h4> <div class="description"> Returns the non-transformed data the view holds as a collection reference. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line932">line 932</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The non-transformed collection reference. </div> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Collection.html">Collection</a></span> </dd> </dl> <h4 class="name" id="publicData"><span class="type-signature"></span>publicData<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Returns a data object representing the public data this view contains. This can change depending on if transforms are being applied to the view or not. If no transforms are applied then the public data will be the same as the private data the view holds. If transforms are applied then the public data will contain the transformed version of the private data. The public data collection is also used by data binding to only changes to the publicData will show in a data-bound element. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line949">line 949</a> </li></ul></dd> </dl> <h4 class="name" id="query"><span class="type-signature"></span>query<span class="signature">(query<span class="signature-attributes">opt</span>, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Gets / sets the query being used to generate the view data. It does not change or modify the view's query options. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>query</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The query to set.</td> </tr> <tr> <td class="name"><code>refresh</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Whether to refresh the view data after this operation. Defaults to true.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line675">line 675</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="queryAdd"><span class="type-signature"></span>queryAdd<span class="signature">(obj, overwrite, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Add data to the existing query. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>obj</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last">The data whose keys will be added to the existing query object.</td> </tr> <tr> <td class="name"><code>overwrite</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> </td> <td class="description last">Whether or not to overwrite data that already exists in the query object. Defaults to true.</td> </tr> <tr> <td class="name"><code>refresh</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Whether or not to refresh the view data set once the operation is complete. Defaults to true.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line618">line 618</a> </li></ul></dd> </dl> <h4 class="name" id="queryData"><span class="type-signature"></span>queryData<span class="signature">(query<span class="signature-attributes">opt</span>, options<span class="signature-attributes">opt</span>, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Gets / sets the query object and query options that the view uses to build it's data set. This call modifies both the query and query options at the same time. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>query</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The query to set.</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">The query options object.</td> </tr> <tr> <td class="name"><code>refresh</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Whether to refresh the view data after this operation. Defaults to true.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line589">line 589</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="queryOptions"><span class="type-signature"></span>queryOptions<span class="signature">(options<span class="signature-attributes">opt</span>, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Gets / sets the query options used when applying sorting etc to the view data set. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">An options object.</td> </tr> <tr> <td class="name"><code>refresh</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Whether to refresh the view data after this operation. Defaults to true.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="View.js.html">View.js</a>, <a href="View.js.html#line780">line 780</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="queryRemove"><span class="type-signature"></span>queryRemove<span class="signature">(obj, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Remove data from the existing query. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>obj</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last">The data whose keys will be removed from the existing query object.</td>