backgrid-filter
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -90,2 +90,10 @@ Ext.data.JsonP.Backgrid_Extension_ClientSideFilter({ | ||
{ | ||
"name": "value", | ||
"tagname": "property", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "property-value" | ||
}, | ||
{ | ||
"name": "wait", | ||
@@ -117,2 +125,10 @@ "tagname": "property", | ||
{ | ||
"name": "clearSearchBox", | ||
"tagname": "method", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "method-clearSearchBox" | ||
}, | ||
{ | ||
"name": "initialize", | ||
@@ -142,2 +158,10 @@ "tagname": "method", | ||
{ | ||
"name": "query", | ||
"tagname": "method", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "method-query" | ||
}, | ||
{ | ||
"name": "render", | ||
@@ -186,3 +210,3 @@ "tagname": "method", | ||
}, | ||
"linenr": 176, | ||
"linenr": 204, | ||
"files": [ | ||
@@ -229,3 +253,3 @@ { | ||
], | ||
"html": "<div><pre class=\"hierarchy\"><h4>Hierarchy</h4><div class='subclass first-child'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='docClass'>Backgrid.Extension.ServerSideFilter</a><div class='subclass '><strong>Backgrid.Extension.ClientSideFilter</strong></div></div><h4>Subclasses</h4><div class='dependency'><a href='#!/api/Backgrid.Extension.LunrFilter' rel='Backgrid.Extension.LunrFilter' class='docClass'>Backgrid.Extension.LunrFilter</a></div></pre><div class='doc-contents'><p>ClientSideFilter is a search form widget that searches a collection for\nmodel matches against a query on the client side. The exact matching\nalgorithm can be overriden by subclasses.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-property'>Properties</h3><div class='subsection'><div id='property-className' class='member first-child inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-className' class='name expandable'>className</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"backgrid-filter form-search"</code></p></div></div></div><div id='property-events' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-events' class='name not-expandable'>events</a><span> : Object</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-property-events' rel='Backgrid.Extension.ServerSideFilter-property-events' class='docClass'>Backgrid.Extension.ServerSideFilter.events</a></p></div></div></div><div id='property-fields' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-fields' class='name expandable'>fields</a><span> : ?Array.<string></span></div><div class='description'><div class='short'>A list of model field names to\nsearch for matches. ...</div><div class='long'><p>A list of model field names to\nsearch for matches. If null, all of the fields will be searched.</p>\n</div></div></div><div id='property-name' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-name' class='name expandable'>name</a><span> : string</span></div><div class='description'><div class='short'>Query key ...</div><div class='long'><p>Query key</p>\n<p>Defaults to: <code>'q'</code></p></div></div></div><div id='property-placeholder' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-placeholder' class='name not-expandable'>placeholder</a><span> : string</span></div><div class='description'><div class='short'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div><div class='long'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div></div></div><div id='property-tagName' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-tagName' class='name expandable'>tagName</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"form"</code></p></div></div></div><div id='property-template' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-template' class='name not-expandable'>template</a><span> : function(Object, ?Object=): string</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n</div></div></div><div id='property-wait' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-wait' class='name expandable'>wait</a><span> : Number</span></div><div class='description'><div class='short'>The time in milliseconds to wait since the last\nchange to the search box's value before searching. ...</div><div class='long'><p>The time in milliseconds to wait since the last\nchange to the search box's value before searching. This value can be\nadjusted depending on how often the search box is used and how large the\nsearch index is.</p>\n<p>Defaults to: <code>149</code></p></div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-clear' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-clear' class='name expandable'>clear</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Clears the search box and reset the collection to its original. ...</div><div class='long'><p>Clears the search box and reset the collection to its original.</p>\n\n<p>If the collection is a PageableCollection, clearing will go back to the\nfirst page.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clear' rel='Backgrid.Extension.ServerSideFilter-method-clear' class='docClass'>Backgrid.Extension.ServerSideFilter.clear</a></p></div></div></div><div id='method-clearButton' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearButton' class='name expandable'>clearButton</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the clear button. ...</div><div class='long'><p>Returns the clear button.</p>\n</div></div></div><div id='method-initialize' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-initialize' class='name expandable'>initialize</a>( <span class='pre'>options</span> )</div><div class='description'><div class='short'>Debounces the search and clear methods and makes a copy of the given\ncollection for searching. ...</div><div class='long'><p>Debounces the <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-search\" rel=\"Backgrid.Extension.ClientSideFilter-method-search\" class=\"docClass\">search</a> and <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-clear\" rel=\"Backgrid.Extension.ClientSideFilter-method-clear\" class=\"docClass\">clear</a> methods and makes a copy of the given\ncollection for searching.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>options</span> : Object<div class='sub-desc'>\n<ul><li><span class='pre'>collection</span> : Backbone.Collection<div class='sub-desc'></div></li><li><span class='pre'>placeholder</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>fields</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>wait</span> : string (optional)<div class='sub-desc'><p>Defaults to: <code>149</code></p></div></li></ul></div></li></ul><p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-method-initialize' rel='Backgrid.Extension.ServerSideFilter-method-initialize' class='docClass'>Backgrid.Extension.ServerSideFilter.initialize</a></p></div></div></div><div id='method-makeMatcher' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-makeMatcher' class='name expandable'>makeMatcher</a>( <span class='pre'>query</span> ) : function(Backbone.Model):boolean</div><div class='description'><div class='short'>This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's...</div><div class='long'><p>This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a> or all of its\nfields if <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a> is null, for any of the words in the query\ncase-insensitively using the regular expression object returned from</p>\n\n<h1>makeRegExp.</h1>\n\n<p>Most of time, you'd want to override the regular expression used for\nmatching. If so, please refer to the <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-makeRegExp\" rel=\"Backgrid.Extension.ClientSideFilter-method-makeRegExp\" class=\"docClass\">makeRegExp</a> documentation,\notherwise, you can override this method to return a custom matching\nfunction.</p>\n\n<p>Subclasses overriding this method must take care to conform to the\nsignature of the matcher function. The matcher function is a function\nthat takes a model as paramter and returns true if the model matches a\nsearch, or false otherwise.</p>\n\n<p>In addition, when the matcher function is called, its context will be\nbound to this ClientSideFilter object so it has access to the filter's\nattributes and methods.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>query</span> : string<div class='sub-desc'><p>The search query in the search box.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>function(Backbone.Model):boolean</span><div class='sub-desc'><p>A matching function.</p>\n</div></li></ul></div></div></div><div id='method-makeRegExp' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-makeRegExp' class='name expandable'>makeRegExp</a>( <span class='pre'>query</span> ) : RegExp</div><div class='description'><div class='short'>Constructs a Javascript regular expression object for makeMatcher. ...</div><div class='long'><p>Constructs a Javascript regular expression object for <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-makeMatcher\" rel=\"Backgrid.Extension.ClientSideFilter-method-makeMatcher\" class=\"docClass\">makeMatcher</a>.</p>\n\n<p>This default implementation takes a query string and returns a Javascript\nRegExp object that matches any of the words contained in the query string\ncase-insensitively. Override this method to return a different regular\nexpression matcher if this behavior is not desired.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>query</span> : string<div class='sub-desc'><p>The search query in the search box.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>RegExp</span><div class='sub-desc'><p>A RegExp object to match against model <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a>.</p>\n</div></li></ul></div></div></div><div id='method-render' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-render' class='name expandable'>render</a>( <span class='pre'></span> ) : <a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a><strong class='chainable signature' >chainable</strong></div><div class='description'><div class='short'>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...</div><div class='long'><p>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-search' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-search' class='name expandable'>search</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Takes the query from the search box, constructs a matcher with it and\nloops through collection looking for matches. ...</div><div class='long'><p>Takes the query from the search box, constructs a matcher with it and\nloops through collection looking for matches. Reset the given collection\nwhen all the matches have been found.</p>\n\n<p>If the collection is a PageableCollection, searching will go back to the\nfirst page.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-method-search' rel='Backgrid.Extension.ServerSideFilter-method-search' class='docClass'>Backgrid.Extension.ServerSideFilter.search</a></p></div></div></div><div id='method-searchBox' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-searchBox' class='name expandable'>searchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the search input box. ...</div><div class='long'><p>Returns the search input box.</p>\n</div></div></div><div id='method-showClearButtonMaybe' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-showClearButtonMaybe' class='name expandable'>showClearButtonMaybe</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Show the clear button when the search box has text, hide\nit otherwise.</p>\n</div></div></div></div></div></div></div>" | ||
"html": "<div><pre class=\"hierarchy\"><h4>Hierarchy</h4><div class='subclass first-child'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='docClass'>Backgrid.Extension.ServerSideFilter</a><div class='subclass '><strong>Backgrid.Extension.ClientSideFilter</strong></div></div><h4>Subclasses</h4><div class='dependency'><a href='#!/api/Backgrid.Extension.LunrFilter' rel='Backgrid.Extension.LunrFilter' class='docClass'>Backgrid.Extension.LunrFilter</a></div></pre><div class='doc-contents'><p>ClientSideFilter is a search form widget that searches a collection for\nmodel matches against a query on the client side. The exact matching\nalgorithm can be overriden by subclasses.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-property'>Properties</h3><div class='subsection'><div id='property-className' class='member first-child inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-className' class='name expandable'>className</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"backgrid-filter form-search"</code></p></div></div></div><div id='property-events' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-events' class='name not-expandable'>events</a><span> : Object</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-property-events' rel='Backgrid.Extension.ServerSideFilter-property-events' class='docClass'>Backgrid.Extension.ServerSideFilter.events</a></p></div></div></div><div id='property-fields' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-fields' class='name expandable'>fields</a><span> : ?Array.<string></span></div><div class='description'><div class='short'>A list of model field names to\nsearch for matches. ...</div><div class='long'><p>A list of model field names to\nsearch for matches. If null, all of the fields will be searched.</p>\n</div></div></div><div id='property-name' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-name' class='name expandable'>name</a><span> : string</span></div><div class='description'><div class='short'>Query key ...</div><div class='long'><p>Query key</p>\n<p>Defaults to: <code>'q'</code></p></div></div></div><div id='property-placeholder' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-placeholder' class='name not-expandable'>placeholder</a><span> : string</span></div><div class='description'><div class='short'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div><div class='long'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div></div></div><div id='property-tagName' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-tagName' class='name expandable'>tagName</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"form"</code></p></div></div></div><div id='property-template' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-template' class='name not-expandable'>template</a><span> : function(Object, ?Object=): string</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n</div></div></div><div id='property-value' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-value' class='name not-expandable'>value</a><span> : string</span></div><div class='description'><div class='short'><p>The search box value.</p>\n</div><div class='long'><p>The search box value.</p>\n</div></div></div><div id='property-wait' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-wait' class='name expandable'>wait</a><span> : Number</span></div><div class='description'><div class='short'>The time in milliseconds to wait since the last\nchange to the search box's value before searching. ...</div><div class='long'><p>The time in milliseconds to wait since the last\nchange to the search box's value before searching. This value can be\nadjusted depending on how often the search box is used and how large the\nsearch index is.</p>\n<p>Defaults to: <code>149</code></p></div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-clear' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-clear' class='name expandable'>clear</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Clears the search box and reset the collection to its original. ...</div><div class='long'><p>Clears the search box and reset the collection to its original.</p>\n\n<p>If the collection is a PageableCollection, clearing will go back to the\nfirst page.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clear' rel='Backgrid.Extension.ServerSideFilter-method-clear' class='docClass'>Backgrid.Extension.ServerSideFilter.clear</a></p></div></div></div><div id='method-clearButton' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearButton' class='name expandable'>clearButton</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the clear button. ...</div><div class='long'><p>Returns the clear button.</p>\n</div></div></div><div id='method-clearSearchBox' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearSearchBox' class='name expandable'>clearSearchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Clear the search box and reset the internal search value.</p>\n</div></div></div><div id='method-initialize' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-initialize' class='name expandable'>initialize</a>( <span class='pre'>options</span> )</div><div class='description'><div class='short'>Debounces the search and clear methods and makes a copy of the given\ncollection for searching. ...</div><div class='long'><p>Debounces the <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-search\" rel=\"Backgrid.Extension.ClientSideFilter-method-search\" class=\"docClass\">search</a> and <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-clear\" rel=\"Backgrid.Extension.ClientSideFilter-method-clear\" class=\"docClass\">clear</a> methods and makes a copy of the given\ncollection for searching.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>options</span> : Object<div class='sub-desc'>\n<ul><li><span class='pre'>collection</span> : Backbone.Collection<div class='sub-desc'></div></li><li><span class='pre'>placeholder</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>fields</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>wait</span> : string (optional)<div class='sub-desc'><p>Defaults to: <code>149</code></p></div></li></ul></div></li></ul><p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-method-initialize' rel='Backgrid.Extension.ServerSideFilter-method-initialize' class='docClass'>Backgrid.Extension.ServerSideFilter.initialize</a></p></div></div></div><div id='method-makeMatcher' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-makeMatcher' class='name expandable'>makeMatcher</a>( <span class='pre'>query</span> ) : function(Backbone.Model):boolean</div><div class='description'><div class='short'>This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's...</div><div class='long'><p>This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a> or all of its\nfields if <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a> is null, for any of the words in the query\ncase-insensitively using the regular expression object returned from</p>\n\n<h1>makeRegExp.</h1>\n\n<p>Most of time, you'd want to override the regular expression used for\nmatching. If so, please refer to the <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-makeRegExp\" rel=\"Backgrid.Extension.ClientSideFilter-method-makeRegExp\" class=\"docClass\">makeRegExp</a> documentation,\notherwise, you can override this method to return a custom matching\nfunction.</p>\n\n<p>Subclasses overriding this method must take care to conform to the\nsignature of the matcher function. The matcher function is a function\nthat takes a model as paramter and returns true if the model matches a\nsearch, or false otherwise.</p>\n\n<p>In addition, when the matcher function is called, its context will be\nbound to this ClientSideFilter object so it has access to the filter's\nattributes and methods.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>query</span> : string<div class='sub-desc'><p>The search query in the search box.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>function(Backbone.Model):boolean</span><div class='sub-desc'><p>A matching function.</p>\n</div></li></ul></div></div></div><div id='method-makeRegExp' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-makeRegExp' class='name expandable'>makeRegExp</a>( <span class='pre'>query</span> ) : RegExp</div><div class='description'><div class='short'>Constructs a Javascript regular expression object for makeMatcher. ...</div><div class='long'><p>Constructs a Javascript regular expression object for <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-makeMatcher\" rel=\"Backgrid.Extension.ClientSideFilter-method-makeMatcher\" class=\"docClass\">makeMatcher</a>.</p>\n\n<p>This default implementation takes a query string and returns a Javascript\nRegExp object that matches any of the words contained in the query string\ncase-insensitively. Override this method to return a different regular\nexpression matcher if this behavior is not desired.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>query</span> : string<div class='sub-desc'><p>The search query in the search box.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>RegExp</span><div class='sub-desc'><p>A RegExp object to match against model <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a>.</p>\n</div></li></ul></div></div></div><div id='method-query' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-query' class='name expandable'>query</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the current search query. ...</div><div class='long'><p>Returns the current search query.</p>\n</div></div></div><div id='method-render' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-render' class='name expandable'>render</a>( <span class='pre'></span> ) : <a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a><strong class='chainable signature' >chainable</strong></div><div class='description'><div class='short'>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...</div><div class='long'><p>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-search' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ClientSideFilter'>Backgrid.Extension.ClientSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-search' class='name expandable'>search</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Takes the query from the search box, constructs a matcher with it and\nloops through collection looking for matches. ...</div><div class='long'><p>Takes the query from the search box, constructs a matcher with it and\nloops through collection looking for matches. Reset the given collection\nwhen all the matches have been found.</p>\n\n<p>If the collection is a PageableCollection, searching will go back to the\nfirst page.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-method-search' rel='Backgrid.Extension.ServerSideFilter-method-search' class='docClass'>Backgrid.Extension.ServerSideFilter.search</a></p></div></div></div><div id='method-searchBox' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-searchBox' class='name expandable'>searchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the search input box. ...</div><div class='long'><p>Returns the search input box.</p>\n</div></div></div><div id='method-showClearButtonMaybe' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-showClearButtonMaybe' class='name expandable'>showClearButtonMaybe</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Show the clear button when the search box has text, hide\nit otherwise.</p>\n</div></div></div></div></div></div></div>" | ||
}); |
@@ -98,2 +98,10 @@ Ext.data.JsonP.Backgrid_Extension_LunrFilter({ | ||
{ | ||
"name": "value", | ||
"tagname": "property", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "property-value" | ||
}, | ||
{ | ||
"name": "wait", | ||
@@ -133,2 +141,10 @@ "tagname": "property", | ||
{ | ||
"name": "clearSearchBox", | ||
"tagname": "method", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "method-clearSearchBox" | ||
}, | ||
{ | ||
"name": "initialize", | ||
@@ -158,2 +174,10 @@ "tagname": "method", | ||
{ | ||
"name": "query", | ||
"tagname": "method", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "method-query" | ||
}, | ||
{ | ||
"name": "removeFromIndex", | ||
@@ -226,3 +250,3 @@ "tagname": "method", | ||
}, | ||
"linenr": 346, | ||
"linenr": 373, | ||
"files": [ | ||
@@ -270,3 +294,3 @@ { | ||
], | ||
"html": "<div><pre class=\"hierarchy\"><h4>Hierarchy</h4><div class='subclass first-child'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='docClass'>Backgrid.Extension.ServerSideFilter</a><div class='subclass '><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='docClass'>Backgrid.Extension.ClientSideFilter</a><div class='subclass '><strong>Backgrid.Extension.LunrFilter</strong></div></div></div></pre><div class='doc-contents'><p>LunrFilter is a ClientSideFilter that uses <a href=\"http://lunrjs.com/\">lunrjs</a> to\nindex the text fields of each model for a collection, and performs\nfull-text searching.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-property'>Properties</h3><div class='subsection'><div id='property-className' class='member first-child inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-className' class='name expandable'>className</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"backgrid-filter form-search"</code></p></div></div></div><div id='property-events' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-events' class='name not-expandable'>events</a><span> : Object</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-property-events' rel='Backgrid.Extension.ServerSideFilter-property-events' class='docClass'>Backgrid.Extension.ServerSideFilter.events</a></p></div></div></div><div id='property-fields' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-property-fields' class='name expandable'>fields</a><span> : Object</span></div><div class='description'><div class='short'>A hash of lunrjs index field names and boost\nvalue. ...</div><div class='long'><p>A hash of <code>lunrjs</code> index field names and boost\nvalue. Unlike ClientSideFilter#fields, LunrFilter#fields is <em>required</em> to\ninitialize the index.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ClientSideFilter-property-fields' rel='Backgrid.Extension.ClientSideFilter-property-fields' class='docClass'>Backgrid.Extension.ClientSideFilter.fields</a></p></div></div></div><div id='property-name' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-name' class='name expandable'>name</a><span> : string</span></div><div class='description'><div class='short'>Query key ...</div><div class='long'><p>Query key</p>\n<p>Defaults to: <code>'q'</code></p></div></div></div><div id='property-placeholder' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-placeholder' class='name not-expandable'>placeholder</a><span> : string</span></div><div class='description'><div class='short'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div><div class='long'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div></div></div><div id='property-ref' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-property-ref' class='name expandable'>ref</a><span> : string</span></div><div class='description'><div class='short'>`lunrjs` document reference attribute name. ...</div><div class='long'><p>`lunrjs` document reference attribute name.</p>\n<p>Defaults to: <code>"id"</code></p></div></div></div><div id='property-tagName' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-tagName' class='name expandable'>tagName</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"form"</code></p></div></div></div><div id='property-template' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-template' class='name not-expandable'>template</a><span> : function(Object, ?Object=): string</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n</div></div></div><div id='property-wait' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-wait' class='name expandable'>wait</a><span> : Number</span></div><div class='description'><div class='short'>The time in milliseconds to wait since the last\nchange to the search box's value before searching. ...</div><div class='long'><p>The time in milliseconds to wait since the last\nchange to the search box's value before searching. This value can be\nadjusted depending on how often the search box is used and how large the\nsearch index is.</p>\n<p>Defaults to: <code>149</code></p></div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-addToIndex' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-addToIndex' class='name expandable'>addToIndex</a>( <span class='pre'>model</span> )</div><div class='description'><div class='short'>Adds the given model to the index. ...</div><div class='long'><p>Adds the given model to the index.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>model</span> : Backbone.Model<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-clear' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-clear' class='name expandable'>clear</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Clears the search box and reset the collection to its original. ...</div><div class='long'><p>Clears the search box and reset the collection to its original.</p>\n\n<p>If the collection is a PageableCollection, clearing will go back to the\nfirst page.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clear' rel='Backgrid.Extension.ServerSideFilter-method-clear' class='docClass'>Backgrid.Extension.ServerSideFilter.clear</a></p></div></div></div><div id='method-clearButton' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearButton' class='name expandable'>clearButton</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the clear button. ...</div><div class='long'><p>Returns the clear button.</p>\n</div></div></div><div id='method-initialize' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-initialize' class='name expandable'>initialize</a>( <span class='pre'>options</span> )</div><div class='description'><div class='short'>Indexes the underlying collection on construction. ...</div><div class='long'><p>Indexes the underlying collection on construction. The index will refresh\nwhen the underlying collection is reset. If any model is added, removed\nor if any indexed fields of any models has changed, the index will be\nupdated.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>options</span> : Object<div class='sub-desc'>\n<ul><li><span class='pre'>collection</span> : Backbone.Collection<div class='sub-desc'></div></li><li><span class='pre'>placeholder</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>ref</span> : string (optional)<div class='sub-desc'><p>`lunrjs` document reference attribute name.</p>\n</div></li><li><span class='pre'>fields</span> : Object (optional)<div class='sub-desc'><p>A hash of <code>lunrjs</code> index field names and\nboost value.</p>\n</div></li><li><span class='pre'>wait</span> : number (optional)<div class='sub-desc'></div></li></ul></div></li></ul><p>Overrides: <a href='#!/api/Backgrid.Extension.ClientSideFilter-method-initialize' rel='Backgrid.Extension.ClientSideFilter-method-initialize' class='docClass'>Backgrid.Extension.ClientSideFilter.initialize</a></p></div></div></div><div id='method-makeMatcher' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-makeMatcher' class='name expandable'>makeMatcher</a>( <span class='pre'>query</span> ) : function(Backbone.Model):boolean</div><div class='description'><div class='short'>This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's...</div><div class='long'><p>This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a> or all of its\nfields if <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a> is null, for any of the words in the query\ncase-insensitively using the regular expression object returned from</p>\n\n<h1>makeRegExp.</h1>\n\n<p>Most of time, you'd want to override the regular expression used for\nmatching. If so, please refer to the <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-makeRegExp\" rel=\"Backgrid.Extension.ClientSideFilter-method-makeRegExp\" class=\"docClass\">makeRegExp</a> documentation,\notherwise, you can override this method to return a custom matching\nfunction.</p>\n\n<p>Subclasses overriding this method must take care to conform to the\nsignature of the matcher function. The matcher function is a function\nthat takes a model as paramter and returns true if the model matches a\nsearch, or false otherwise.</p>\n\n<p>In addition, when the matcher function is called, its context will be\nbound to this ClientSideFilter object so it has access to the filter's\nattributes and methods.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>query</span> : string<div class='sub-desc'><p>The search query in the search box.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>function(Backbone.Model):boolean</span><div class='sub-desc'><p>A matching function.</p>\n</div></li></ul></div></div></div><div id='method-makeRegExp' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-makeRegExp' class='name expandable'>makeRegExp</a>( <span class='pre'>query</span> ) : RegExp</div><div class='description'><div class='short'>Constructs a Javascript regular expression object for makeMatcher. ...</div><div class='long'><p>Constructs a Javascript regular expression object for <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-makeMatcher\" rel=\"Backgrid.Extension.ClientSideFilter-method-makeMatcher\" class=\"docClass\">makeMatcher</a>.</p>\n\n<p>This default implementation takes a query string and returns a Javascript\nRegExp object that matches any of the words contained in the query string\ncase-insensitively. Override this method to return a different regular\nexpression matcher if this behavior is not desired.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>query</span> : string<div class='sub-desc'><p>The search query in the search box.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>RegExp</span><div class='sub-desc'><p>A RegExp object to match against model <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a>.</p>\n</div></li></ul></div></div></div><div id='method-removeFromIndex' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-removeFromIndex' class='name expandable'>removeFromIndex</a>( <span class='pre'>model</span> )</div><div class='description'><div class='short'>Removes the given model from the index. ...</div><div class='long'><p>Removes the given model from the index.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>model</span> : Backbone.Model<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-render' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-render' class='name expandable'>render</a>( <span class='pre'></span> ) : <a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a><strong class='chainable signature' >chainable</strong></div><div class='description'><div class='short'>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...</div><div class='long'><p>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-resetIndex' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-resetIndex' class='name expandable'>resetIndex</a>( <span class='pre'>collection, [options]</span> )</div><div class='description'><div class='short'>Reindex the collection. ...</div><div class='long'><p>Reindex the collection. If <code>options.reindex</code> is <code>false</code>, this method is a\nno-op.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>collection</span> : Backbone.Collection<div class='sub-desc'>\n</div></li><li><span class='pre'>options</span> : Object (optional)<div class='sub-desc'>\n<ul><li><span class='pre'>reindex</span> : boolean (optional)<div class='sub-desc'><p>Defaults to: <code>true</code></p></div></li></ul></div></li></ul></div></div></div><div id='method-search' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-search' class='name expandable'>search</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Takes the query from the search box and performs a full-text search on\nthe client-side. ...</div><div class='long'><p>Takes the query from the search box and performs a full-text search on\nthe client-side. The search result is returned by resetting the\nunderlying collection to the models after interrogating the index for the\nquery answer.</p>\n\n<p>If the collection is a PageableCollection, searching will go back to the\nfirst page.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ClientSideFilter-method-search' rel='Backgrid.Extension.ClientSideFilter-method-search' class='docClass'>Backgrid.Extension.ClientSideFilter.search</a></p></div></div></div><div id='method-searchBox' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-searchBox' class='name expandable'>searchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the search input box. ...</div><div class='long'><p>Returns the search input box.</p>\n</div></div></div><div id='method-showClearButtonMaybe' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-showClearButtonMaybe' class='name expandable'>showClearButtonMaybe</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Show the clear button when the search box has text, hide\nit otherwise.</p>\n</div></div></div><div id='method-updateIndex' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-updateIndex' class='name expandable'>updateIndex</a>( <span class='pre'>model</span> )</div><div class='description'><div class='short'>Updates the index for the given model. ...</div><div class='long'><p>Updates the index for the given model.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>model</span> : Backbone.Model<div class='sub-desc'>\n</div></li></ul></div></div></div></div></div></div></div>" | ||
"html": "<div><pre class=\"hierarchy\"><h4>Hierarchy</h4><div class='subclass first-child'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='docClass'>Backgrid.Extension.ServerSideFilter</a><div class='subclass '><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='docClass'>Backgrid.Extension.ClientSideFilter</a><div class='subclass '><strong>Backgrid.Extension.LunrFilter</strong></div></div></div></pre><div class='doc-contents'><p>LunrFilter is a ClientSideFilter that uses <a href=\"http://lunrjs.com/\">lunrjs</a> to\nindex the text fields of each model for a collection, and performs\nfull-text searching.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-property'>Properties</h3><div class='subsection'><div id='property-className' class='member first-child inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-className' class='name expandable'>className</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"backgrid-filter form-search"</code></p></div></div></div><div id='property-events' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-events' class='name not-expandable'>events</a><span> : Object</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-property-events' rel='Backgrid.Extension.ServerSideFilter-property-events' class='docClass'>Backgrid.Extension.ServerSideFilter.events</a></p></div></div></div><div id='property-fields' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-property-fields' class='name expandable'>fields</a><span> : Object</span></div><div class='description'><div class='short'>A hash of lunrjs index field names and boost\nvalue. ...</div><div class='long'><p>A hash of <code>lunrjs</code> index field names and boost\nvalue. Unlike ClientSideFilter#fields, LunrFilter#fields is <em>required</em> to\ninitialize the index.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ClientSideFilter-property-fields' rel='Backgrid.Extension.ClientSideFilter-property-fields' class='docClass'>Backgrid.Extension.ClientSideFilter.fields</a></p></div></div></div><div id='property-name' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-name' class='name expandable'>name</a><span> : string</span></div><div class='description'><div class='short'>Query key ...</div><div class='long'><p>Query key</p>\n<p>Defaults to: <code>'q'</code></p></div></div></div><div id='property-placeholder' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-placeholder' class='name not-expandable'>placeholder</a><span> : string</span></div><div class='description'><div class='short'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div><div class='long'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div></div></div><div id='property-ref' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-property-ref' class='name expandable'>ref</a><span> : string</span></div><div class='description'><div class='short'>`lunrjs` document reference attribute name. ...</div><div class='long'><p>`lunrjs` document reference attribute name.</p>\n<p>Defaults to: <code>"id"</code></p></div></div></div><div id='property-tagName' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-tagName' class='name expandable'>tagName</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"form"</code></p></div></div></div><div id='property-template' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-template' class='name not-expandable'>template</a><span> : function(Object, ?Object=): string</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n</div></div></div><div id='property-value' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-value' class='name not-expandable'>value</a><span> : string</span></div><div class='description'><div class='short'><p>The search box value.</p>\n</div><div class='long'><p>The search box value.</p>\n</div></div></div><div id='property-wait' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-property-wait' class='name expandable'>wait</a><span> : Number</span></div><div class='description'><div class='short'>The time in milliseconds to wait since the last\nchange to the search box's value before searching. ...</div><div class='long'><p>The time in milliseconds to wait since the last\nchange to the search box's value before searching. This value can be\nadjusted depending on how often the search box is used and how large the\nsearch index is.</p>\n<p>Defaults to: <code>149</code></p></div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-addToIndex' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-addToIndex' class='name expandable'>addToIndex</a>( <span class='pre'>model</span> )</div><div class='description'><div class='short'>Adds the given model to the index. ...</div><div class='long'><p>Adds the given model to the index.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>model</span> : Backbone.Model<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-clear' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-clear' class='name expandable'>clear</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Clears the search box and reset the collection to its original. ...</div><div class='long'><p>Clears the search box and reset the collection to its original.</p>\n\n<p>If the collection is a PageableCollection, clearing will go back to the\nfirst page.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clear' rel='Backgrid.Extension.ServerSideFilter-method-clear' class='docClass'>Backgrid.Extension.ServerSideFilter.clear</a></p></div></div></div><div id='method-clearButton' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearButton' class='name expandable'>clearButton</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the clear button. ...</div><div class='long'><p>Returns the clear button.</p>\n</div></div></div><div id='method-clearSearchBox' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearSearchBox' class='name expandable'>clearSearchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Clear the search box and reset the internal search value.</p>\n</div></div></div><div id='method-initialize' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-initialize' class='name expandable'>initialize</a>( <span class='pre'>options</span> )</div><div class='description'><div class='short'>Indexes the underlying collection on construction. ...</div><div class='long'><p>Indexes the underlying collection on construction. The index will refresh\nwhen the underlying collection is reset. If any model is added, removed\nor if any indexed fields of any models has changed, the index will be\nupdated.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>options</span> : Object<div class='sub-desc'>\n<ul><li><span class='pre'>collection</span> : Backbone.Collection<div class='sub-desc'></div></li><li><span class='pre'>placeholder</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>ref</span> : string (optional)<div class='sub-desc'><p>`lunrjs` document reference attribute name.</p>\n</div></li><li><span class='pre'>fields</span> : Object (optional)<div class='sub-desc'><p>A hash of <code>lunrjs</code> index field names and\nboost value.</p>\n</div></li><li><span class='pre'>wait</span> : number (optional)<div class='sub-desc'></div></li></ul></div></li></ul><p>Overrides: <a href='#!/api/Backgrid.Extension.ClientSideFilter-method-initialize' rel='Backgrid.Extension.ClientSideFilter-method-initialize' class='docClass'>Backgrid.Extension.ClientSideFilter.initialize</a></p></div></div></div><div id='method-makeMatcher' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-makeMatcher' class='name expandable'>makeMatcher</a>( <span class='pre'>query</span> ) : function(Backbone.Model):boolean</div><div class='description'><div class='short'>This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's...</div><div class='long'><p>This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a> or all of its\nfields if <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a> is null, for any of the words in the query\ncase-insensitively using the regular expression object returned from</p>\n\n<h1>makeRegExp.</h1>\n\n<p>Most of time, you'd want to override the regular expression used for\nmatching. If so, please refer to the <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-makeRegExp\" rel=\"Backgrid.Extension.ClientSideFilter-method-makeRegExp\" class=\"docClass\">makeRegExp</a> documentation,\notherwise, you can override this method to return a custom matching\nfunction.</p>\n\n<p>Subclasses overriding this method must take care to conform to the\nsignature of the matcher function. The matcher function is a function\nthat takes a model as paramter and returns true if the model matches a\nsearch, or false otherwise.</p>\n\n<p>In addition, when the matcher function is called, its context will be\nbound to this ClientSideFilter object so it has access to the filter's\nattributes and methods.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>query</span> : string<div class='sub-desc'><p>The search query in the search box.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>function(Backbone.Model):boolean</span><div class='sub-desc'><p>A matching function.</p>\n</div></li></ul></div></div></div><div id='method-makeRegExp' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='defined-in docClass'>Backgrid.Extension.ClientSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ClientSideFilter-method-makeRegExp' class='name expandable'>makeRegExp</a>( <span class='pre'>query</span> ) : RegExp</div><div class='description'><div class='short'>Constructs a Javascript regular expression object for makeMatcher. ...</div><div class='long'><p>Constructs a Javascript regular expression object for <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-method-makeMatcher\" rel=\"Backgrid.Extension.ClientSideFilter-method-makeMatcher\" class=\"docClass\">makeMatcher</a>.</p>\n\n<p>This default implementation takes a query string and returns a Javascript\nRegExp object that matches any of the words contained in the query string\ncase-insensitively. Override this method to return a different regular\nexpression matcher if this behavior is not desired.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>query</span> : string<div class='sub-desc'><p>The search query in the search box.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>RegExp</span><div class='sub-desc'><p>A RegExp object to match against model <a href=\"#!/api/Backgrid.Extension.ClientSideFilter-property-fields\" rel=\"Backgrid.Extension.ClientSideFilter-property-fields\" class=\"docClass\">fields</a>.</p>\n</div></li></ul></div></div></div><div id='method-query' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-query' class='name expandable'>query</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the current search query. ...</div><div class='long'><p>Returns the current search query.</p>\n</div></div></div><div id='method-removeFromIndex' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-removeFromIndex' class='name expandable'>removeFromIndex</a>( <span class='pre'>model</span> )</div><div class='description'><div class='short'>Removes the given model from the index. ...</div><div class='long'><p>Removes the given model from the index.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>model</span> : Backbone.Model<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-render' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-render' class='name expandable'>render</a>( <span class='pre'></span> ) : <a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a><strong class='chainable signature' >chainable</strong></div><div class='description'><div class='short'>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...</div><div class='long'><p>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-resetIndex' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-resetIndex' class='name expandable'>resetIndex</a>( <span class='pre'>collection, [options]</span> )</div><div class='description'><div class='short'>Reindex the collection. ...</div><div class='long'><p>Reindex the collection. If <code>options.reindex</code> is <code>false</code>, this method is a\nno-op.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>collection</span> : Backbone.Collection<div class='sub-desc'>\n</div></li><li><span class='pre'>options</span> : Object (optional)<div class='sub-desc'>\n<ul><li><span class='pre'>reindex</span> : boolean (optional)<div class='sub-desc'><p>Defaults to: <code>true</code></p></div></li></ul></div></li></ul></div></div></div><div id='method-search' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-search' class='name expandable'>search</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Takes the query from the search box and performs a full-text search on\nthe client-side. ...</div><div class='long'><p>Takes the query from the search box and performs a full-text search on\nthe client-side. The search result is returned by resetting the\nunderlying collection to the models after interrogating the index for the\nquery answer.</p>\n\n<p>If the collection is a PageableCollection, searching will go back to the\nfirst page.</p>\n<p>Overrides: <a href='#!/api/Backgrid.Extension.ClientSideFilter-method-search' rel='Backgrid.Extension.ClientSideFilter-method-search' class='docClass'>Backgrid.Extension.ClientSideFilter.search</a></p></div></div></div><div id='method-searchBox' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-searchBox' class='name expandable'>searchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the search input box. ...</div><div class='long'><p>Returns the search input box.</p>\n</div></div></div><div id='method-showClearButtonMaybe' class='member inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><a href='#!/api/Backgrid.Extension.ServerSideFilter' rel='Backgrid.Extension.ServerSideFilter' class='defined-in docClass'>Backgrid.Extension.ServerSideFilter</a><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-showClearButtonMaybe' class='name expandable'>showClearButtonMaybe</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Show the clear button when the search box has text, hide\nit otherwise.</p>\n</div></div></div><div id='method-updateIndex' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.LunrFilter'>Backgrid.Extension.LunrFilter</span><br/></div><a href='#!/api/Backgrid.Extension.LunrFilter-method-updateIndex' class='name expandable'>updateIndex</a>( <span class='pre'>model</span> )</div><div class='description'><div class='short'>Updates the index for the given model. ...</div><div class='long'><p>Updates the index for the given model.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>model</span> : Backbone.Model<div class='sub-desc'>\n</div></li></ul></div></div></div></div></div></div></div>" | ||
}); |
@@ -80,2 +80,10 @@ Ext.data.JsonP.Backgrid_Extension_ServerSideFilter({ | ||
"id": "property-template" | ||
}, | ||
{ | ||
"name": "value", | ||
"tagname": "property", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "property-value" | ||
} | ||
@@ -101,2 +109,10 @@ ], | ||
{ | ||
"name": "clearSearchBox", | ||
"tagname": "method", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "method-clearSearchBox" | ||
}, | ||
{ | ||
"name": "initialize", | ||
@@ -110,2 +126,10 @@ "tagname": "method", | ||
{ | ||
"name": "query", | ||
"tagname": "method", | ||
"owner": "Backgrid.Extension.ServerSideFilter", | ||
"meta": { | ||
}, | ||
"id": "method-query" | ||
}, | ||
{ | ||
"name": "render", | ||
@@ -154,3 +178,3 @@ "tagname": "method", | ||
}, | ||
"linenr": 30, | ||
"linenr": 35, | ||
"files": [ | ||
@@ -197,3 +221,3 @@ { | ||
], | ||
"html": "<div><pre class=\"hierarchy\"><h4>Subclasses</h4><div class='dependency'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='docClass'>Backgrid.Extension.ClientSideFilter</a></div></pre><div class='doc-contents'><p>ServerSideFilter is a search form widget that submits a query to the server\nfor filtering the current collection.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-property'>Properties</h3><div class='subsection'><div id='property-className' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-className' class='name expandable'>className</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"backgrid-filter form-search"</code></p></div></div></div><div id='property-events' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-events' class='name expandable'>events</a><span> : Object</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>{"keyup input[type=search]": "showClearButtonMaybe", "click a[data-backgrid-action=clear]": "clear", "submit": "search"}</code></p></div></div></div><div id='property-name' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-name' class='name expandable'>name</a><span> : string</span></div><div class='description'><div class='short'>Query key ...</div><div class='long'><p>Query key</p>\n<p>Defaults to: <code>'q'</code></p></div></div></div><div id='property-placeholder' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-placeholder' class='name not-expandable'>placeholder</a><span> : string</span></div><div class='description'><div class='short'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div><div class='long'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div></div></div><div id='property-tagName' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-tagName' class='name expandable'>tagName</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"form"</code></p></div></div></div><div id='property-template' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-template' class='name not-expandable'>template</a><span> : function(Object, ?Object=): string</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n</div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-clear' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clear' class='name expandable'>clear</a>( <span class='pre'>e</span> )</div><div class='description'><div class='short'>Event handler for the clear button. ...</div><div class='long'><p>Event handler for the clear button. Clears the search box and refetch the\ncollection.</p>\n\n<p>If the collection is a PageableCollection, clearing will go back to the\nfirst page.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>e</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-clearButton' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearButton' class='name expandable'>clearButton</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the clear button. ...</div><div class='long'><p>Returns the clear button.</p>\n</div></div></div><div id='method-initialize' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-initialize' class='name expandable'>initialize</a>( <span class='pre'>options</span> )</div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>options</span> : Object<div class='sub-desc'>\n<ul><li><span class='pre'>collection</span> : Backbone.Collection<div class='sub-desc'></div></li><li><span class='pre'>name</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>placeholder</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>template</span> : function(Object): string (optional)<div class='sub-desc'></div></li></ul></div></li></ul></div></div></div><div id='method-render' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-render' class='name expandable'>render</a>( <span class='pre'></span> ) : <a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a><strong class='chainable signature' >chainable</strong></div><div class='description'><div class='short'>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...</div><div class='long'><p>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-search' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-search' class='name expandable'>search</a>( <span class='pre'>e</span> )</div><div class='description'><div class='short'>Upon search form submission, this event handler constructs a query\nparameter object and pass it to Collection#fetch f...</div><div class='long'><p>Upon search form submission, this event handler constructs a query\nparameter object and pass it to Collection#fetch for server-side\nfiltering.</p>\n\n<p>If the collection is a PageableCollection, searching will go back to the\nfirst page.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>e</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-searchBox' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-searchBox' class='name expandable'>searchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the search input box. ...</div><div class='long'><p>Returns the search input box.</p>\n</div></div></div><div id='method-showClearButtonMaybe' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-showClearButtonMaybe' class='name expandable'>showClearButtonMaybe</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Show the clear button when the search box has text, hide\nit otherwise.</p>\n</div></div></div></div></div></div></div>" | ||
"html": "<div><pre class=\"hierarchy\"><h4>Subclasses</h4><div class='dependency'><a href='#!/api/Backgrid.Extension.ClientSideFilter' rel='Backgrid.Extension.ClientSideFilter' class='docClass'>Backgrid.Extension.ClientSideFilter</a></div></pre><div class='doc-contents'><p>ServerSideFilter is a search form widget that submits a query to the server\nfor filtering the current collection.</p>\n</div><div class='members'><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-property'>Properties</h3><div class='subsection'><div id='property-className' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-className' class='name expandable'>className</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"backgrid-filter form-search"</code></p></div></div></div><div id='property-events' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-events' class='name expandable'>events</a><span> : Object</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>{"keyup input[type=search]": "showClearButtonMaybe", "click a[data-backgrid-action=clear]": "clear", "submit": "search"}</code></p></div></div></div><div id='property-name' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-name' class='name expandable'>name</a><span> : string</span></div><div class='description'><div class='short'>Query key ...</div><div class='long'><p>Query key</p>\n<p>Defaults to: <code>'q'</code></p></div></div></div><div id='property-placeholder' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-placeholder' class='name not-expandable'>placeholder</a><span> : string</span></div><div class='description'><div class='short'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div><div class='long'><p>The HTML5 placeholder to appear beneath\nthe search box.</p>\n</div></div></div><div id='property-tagName' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-tagName' class='name expandable'>tagName</a><span> : String</span></div><div class='description'><div class='short'> ...</div><div class='long'>\n<p>Defaults to: <code>"form"</code></p></div></div></div><div id='property-template' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-template' class='name not-expandable'>template</a><span> : function(Object, ?Object=): string</span></div><div class='description'><div class='short'>\n</div><div class='long'>\n</div></div></div><div id='property-value' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-property-value' class='name not-expandable'>value</a><span> : string</span></div><div class='description'><div class='short'><p>The search box value.</p>\n</div><div class='long'><p>The search box value.</p>\n</div></div></div></div></div><div class='members-section'><div class='definedBy'>Defined By</div><h3 class='members-title icon-method'>Methods</h3><div class='subsection'><div id='method-clear' class='member first-child not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clear' class='name expandable'>clear</a>( <span class='pre'>e</span> )</div><div class='description'><div class='short'>Event handler for the clear button. ...</div><div class='long'><p>Event handler for the clear button. Clears the search box and refetch the\ncollection.</p>\n\n<p>If the collection is a PageableCollection, clearing will go back to the\nfirst page.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>e</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-clearButton' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearButton' class='name expandable'>clearButton</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the clear button. ...</div><div class='long'><p>Returns the clear button.</p>\n</div></div></div><div id='method-clearSearchBox' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-clearSearchBox' class='name expandable'>clearSearchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Clear the search box and reset the internal search value.</p>\n</div></div></div><div id='method-initialize' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-initialize' class='name expandable'>initialize</a>( <span class='pre'>options</span> )</div><div class='description'><div class='short'> ...</div><div class='long'>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>options</span> : Object<div class='sub-desc'>\n<ul><li><span class='pre'>collection</span> : Backbone.Collection<div class='sub-desc'></div></li><li><span class='pre'>name</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>value</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>placeholder</span> : string (optional)<div class='sub-desc'></div></li><li><span class='pre'>template</span> : function(Object): string (optional)<div class='sub-desc'></div></li></ul></div></li></ul></div></div></div><div id='method-query' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-query' class='name expandable'>query</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the current search query. ...</div><div class='long'><p>Returns the current search query.</p>\n</div></div></div><div id='method-render' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-render' class='name expandable'>render</a>( <span class='pre'></span> ) : <a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a><strong class='chainable signature' >chainable</strong></div><div class='description'><div class='short'>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...</div><div class='long'><p>Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Backgrid.Extension.ServerSideFilter\" rel=\"Backgrid.Extension.ServerSideFilter\" class=\"docClass\">Backgrid.Extension.ServerSideFilter</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-search' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-search' class='name expandable'>search</a>( <span class='pre'>e</span> )</div><div class='description'><div class='short'>Upon search form submission, this event handler constructs a query\nparameter object and pass it to Collection#fetch f...</div><div class='long'><p>Upon search form submission, this event handler constructs a query\nparameter object and pass it to Collection#fetch for server-side\nfiltering.</p>\n\n<p>If the collection is a PageableCollection, searching will go back to the\nfirst page.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>e</span> : Object<div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-searchBox' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-searchBox' class='name expandable'>searchBox</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Returns the search input box. ...</div><div class='long'><p>Returns the search input box.</p>\n</div></div></div><div id='method-showClearButtonMaybe' class='member not-inherited'><a href='#' class='side expandable'><span> </span></a><div class='title'><div class='meta'><span class='defined-in' rel='Backgrid.Extension.ServerSideFilter'>Backgrid.Extension.ServerSideFilter</span><br/></div><a href='#!/api/Backgrid.Extension.ServerSideFilter-method-showClearButtonMaybe' class='name expandable'>showClearButtonMaybe</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Event handler. ...</div><div class='long'><p>Event handler. Show the clear button when the search box has text, hide\nit otherwise.</p>\n</div></div></div></div></div></div></div>" | ||
}); |
@@ -0,0 +0,0 @@ !function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; |
@@ -15,10 +15,13 @@ /* | ||
// CommonJS | ||
(function () { | ||
var lunr; | ||
try { lunr = require("lunr"); } catch (e) {} | ||
module.exports = factory(require("underscore"), | ||
require("backbone"), | ||
require("backgrid"), | ||
lunr); | ||
}()); | ||
var lunr; | ||
try { | ||
lunr = require("lunr"); | ||
} catch (e) {} | ||
module.exports = factory( | ||
require("underscore"), | ||
require("backbone"), | ||
require("backgrid"), | ||
lunr | ||
); | ||
} else { | ||
@@ -92,3 +95,3 @@ // Browser | ||
collection.queryParams[this.name] = function () { | ||
return self.searchBox().val() || null; | ||
return self.query() || null; | ||
}; | ||
@@ -113,3 +116,3 @@ } | ||
var $clearButton = this.clearButton(); | ||
var searchTerms = this.searchBox().val(); | ||
var searchTerms = this.query(); | ||
if (searchTerms) $clearButton.show(); | ||
@@ -133,3 +136,2 @@ else $clearButton.hide(); | ||
/** | ||
@@ -271,3 +273,3 @@ Returns the current search query. | ||
this.listenTo(collection, "sort", function (col) { | ||
if (!this.searchBox().val()) shadowCollection.reset(col.models); | ||
if (!this.query()) shadowCollection.reset(col.models); | ||
}); | ||
@@ -274,0 +276,0 @@ this.listenTo(collection, "reset", function (col, options) { |
@@ -8,2 +8,197 @@ /* | ||
*/ | ||
!function(a,b){"object"==typeof exports?!function(){var a;try{a=require("lunr")}catch(c){}module.exports=b(require("underscore"),require("backbone"),require("backgrid"),a)}():b(a._,a.Backbone,a.Backgrid,a.lunr)}(this,function(a,b,c,d){"use strict";var e=c.Extension.ServerSideFilter=b.View.extend({tagName:"form",className:"backgrid-filter form-search",template:function(a){return'<span class="search"> </span><input type="search" '+(a.placeholder?'placeholder="'+a.placeholder+'"':"")+' name="'+a.name+'" '+(a.value?'value="'+a.value+'"':"")+'/><a class="clear" data-backgrid-action="clear" href="#">×</a>'},events:{"keyup input[type=search]":"showClearButtonMaybe","click a[data-backgrid-action=clear]":"clear",submit:"search"},name:"q",value:null,placeholder:null,initialize:function(a){e.__super__.initialize.apply(this,arguments),this.name=a.name||this.name,this.value=a.value||this.value,this.placeholder=a.placeholder||this.placeholder,this.template=a.template||this.template;var c=this.collection,d=this;b.PageableCollection&&c instanceof b.PageableCollection&&"server"==c.mode&&(c.queryParams[this.name]=function(){return d.searchBox().val()||null})},clearSearchBox:function(){this.value=null,this.searchBox().val(null),this.showClearButtonMaybe()},showClearButtonMaybe:function(){var a=this.clearButton(),b=this.searchBox().val();b?a.show():a.hide()},searchBox:function(){return this.$el.find("input[type=search]")},clearButton:function(){return this.$el.find("a[data-backgrid-action=clear]")},query:function(){return this.value=this.searchBox().val(),this.value},search:function(a){a&&a.preventDefault();var c={},d=this.query();d&&(c[this.name]=d);var e=this.collection;b.PageableCollection&&e instanceof b.PageableCollection?e.getFirstPage({data:c,reset:!0,fetch:!0}):e.fetch({data:c,reset:!0})},clear:function(a){a&&a.preventDefault(),this.clearSearchBox();var c=this.collection;b.PageableCollection&&c instanceof b.PageableCollection?c.getFirstPage({reset:!0,fetch:!0}):c.fetch({reset:!0})},render:function(){return this.$el.empty().append(this.template({name:this.name,placeholder:this.placeholder,value:this.value})),this.showClearButtonMaybe(),this.delegateEvents(),this}}),f=c.Extension.ClientSideFilter=e.extend({events:a.extend({},e.prototype.events,{"click a[data-backgrid-action=clear]":function(a){a.preventDefault(),this.clear()},"keydown input[type=search]":"search",submit:function(a){a.preventDefault(),this.search()}}),fields:null,wait:149,initialize:function(b){f.__super__.initialize.apply(this,arguments),this.fields=b.fields||this.fields,this.wait=b.wait||this.wait,this._debounceMethods(["search","clear"]);var c=this.collection=this.collection.fullCollection||this.collection,d=this.shadowCollection=c.clone();this.listenTo(c,"add",function(a,b,c){d.add(a,c)}),this.listenTo(c,"remove",function(a,b,c){d.remove(a,c)}),this.listenTo(c,"sort",function(a){this.searchBox().val()||d.reset(a.models)}),this.listenTo(c,"reset",function(b,c){c=a.extend({reindex:!0},c||{}),c.reindex&&null==c.from&&null==c.to&&d.reset(b.models)})},_debounceMethods:function(b){a.isString(b)&&(b=[b]),this.undelegateEvents();for(var c=0,d=b.length;d>c;c++){var e=b[c],f=this[e];this[e]=a.debounce(f,this.wait)}this.delegateEvents()},makeRegExp:function(a){return new RegExp(a.trim().split(/\s+/).join("|"),"i")},makeMatcher:function(a){var b=this.makeRegExp(a);return function(a){for(var c=this.fields||a.keys(),d=0,e=c.length;e>d;d++)if(b.test(a.get(c[d])+""))return!0;return!1}},search:function(){var b=a.bind(this.makeMatcher(this.query()),this),c=this.collection;c.pageableCollection&&c.pageableCollection.getFirstPage({silent:!0}),c.reset(this.shadowCollection.filter(b),{reindex:!1})},clear:function(){this.clearSearchBox();var a=this.collection;a.pageableCollection&&a.pageableCollection.getFirstPage({silent:!0}),a.reset(this.shadowCollection.models,{reindex:!1})}}),g=c.Extension.LunrFilter=f.extend({ref:"id",fields:null,initialize:function(a){g.__super__.initialize.apply(this,arguments),this.ref=a.ref||this.ref;var b=this.collection=this.collection.fullCollection||this.collection;this.listenTo(b,"add",this.addToIndex),this.listenTo(b,"remove",this.removeFromIndex),this.listenTo(b,"reset",this.resetIndex),this.listenTo(b,"change",this.updateIndex),this.resetIndex(b)},resetIndex:function(b,c){if(c=a.extend({reindex:!0},c||{}),c.reindex){var e=this;this.index=d(function(){a.each(e.fields,function(a,b){this.field(b,a),this.ref(e.ref)},this)}),b.each(function(a){this.addToIndex(a)},this)}},addToIndex:function(a){var b=this.index,c=a.toJSON();b.documentStore.has(c[this.ref])?b.update(c):b.add(c)},removeFromIndex:function(a){var b=this.index,c=a.toJSON();b.documentStore.has(c[this.ref])&&b.remove(c)},updateIndex:function(b){var c=b.changedAttributes();c&&!a.isEmpty(a.intersection(a.keys(this.fields),a.keys(c)))&&this.index.update(b.toJSON())},search:function(){var a=this.collection;if(!this.query())return void a.reset(this.shadowCollection.models,{reindex:!1});for(var b=this.index.search(this.query()),c=[],d=0;d<b.length;d++){var e=b[d];c.push(this.shadowCollection.get(e.ref))}a.pageableCollection&&a.pageableCollection.getFirstPage({silent:!0}),a.reset(c,{reindex:!1})}})}); | ||
!function(a,b){if("function"==typeof define&&define.amd) | ||
// AMD. Register as an anonymous module. | ||
define(["underscore","backbone","backgrid"],b);else if("object"==typeof exports){ | ||
// CommonJS | ||
var c;try{c=require("lunr")}catch(d){}module.exports=b(require("underscore"),require("backbone"),require("backgrid"),c)}else | ||
// Browser | ||
b(a._,a.Backbone,a.Backgrid,a.lunr)}(this,function(a,b,c,d){"use strict";/** | ||
ServerSideFilter is a search form widget that submits a query to the server | ||
for filtering the current collection. | ||
@class Backgrid.Extension.ServerSideFilter | ||
*/ | ||
var e=c.Extension.ServerSideFilter=b.View.extend({/** @property */ | ||
tagName:"form",/** @property */ | ||
className:"backgrid-filter form-search",/** @property {function(Object, ?Object=): string} template */ | ||
template:function(a){return'<span class="search"> </span><input type="search" '+(a.placeholder?'placeholder="'+a.placeholder+'"':"")+' name="'+a.name+'" '+(a.value?'value="'+a.value+'"':"")+'/><a class="clear" data-backgrid-action="clear" href="#">×</a>'},/** @property */ | ||
events:{"keyup input[type=search]":"showClearButtonMaybe","click a[data-backgrid-action=clear]":"clear",submit:"search"},/** @property {string} [name='q'] Query key */ | ||
name:"q",/** @property {string} [value] The search box value. */ | ||
value:null,/** | ||
@property {string} [placeholder] The HTML5 placeholder to appear beneath | ||
the search box. | ||
*/ | ||
placeholder:null,/** | ||
@param {Object} options | ||
@param {Backbone.Collection} options.collection | ||
@param {string} [options.name] | ||
@param {string} [options.value] | ||
@param {string} [options.placeholder] | ||
@param {function(Object): string} [options.template] | ||
*/ | ||
initialize:function(a){e.__super__.initialize.apply(this,arguments),this.name=a.name||this.name,this.value=a.value||this.value,this.placeholder=a.placeholder||this.placeholder,this.template=a.template||this.template; | ||
// Persist the query on pagination | ||
var c=this.collection,d=this;b.PageableCollection&&c instanceof b.PageableCollection&&"server"==c.mode&&(c.queryParams[this.name]=function(){return d.query()||null})},/** | ||
Event handler. Clear the search box and reset the internal search value. | ||
*/ | ||
clearSearchBox:function(){this.value=null,this.searchBox().val(null),this.showClearButtonMaybe()},/** | ||
Event handler. Show the clear button when the search box has text, hide | ||
it otherwise. | ||
*/ | ||
showClearButtonMaybe:function(){var a=this.clearButton(),b=this.query();b?a.show():a.hide()},/** | ||
Returns the search input box. | ||
*/ | ||
searchBox:function(){return this.$el.find("input[type=search]")},/** | ||
Returns the clear button. | ||
*/ | ||
clearButton:function(){return this.$el.find("a[data-backgrid-action=clear]")},/** | ||
Returns the current search query. | ||
*/ | ||
query:function(){return this.value=this.searchBox().val(),this.value},/** | ||
Upon search form submission, this event handler constructs a query | ||
parameter object and pass it to Collection#fetch for server-side | ||
filtering. | ||
If the collection is a PageableCollection, searching will go back to the | ||
first page. | ||
*/ | ||
search:function(a){a&&a.preventDefault();var c={},d=this.query();d&&(c[this.name]=d);var e=this.collection; | ||
// go back to the first page on search | ||
b.PageableCollection&&e instanceof b.PageableCollection?e.getFirstPage({data:c,reset:!0,fetch:!0}):e.fetch({data:c,reset:!0})},/** | ||
Event handler for the clear button. Clears the search box and refetch the | ||
collection. | ||
If the collection is a PageableCollection, clearing will go back to the | ||
first page. | ||
*/ | ||
clear:function(a){a&&a.preventDefault(),this.clearSearchBox();var c=this.collection; | ||
// go back to the first page on clear | ||
b.PageableCollection&&c instanceof b.PageableCollection?c.getFirstPage({reset:!0,fetch:!0}):c.fetch({reset:!0})},/** | ||
Renders a search form with a text box, optionally with a placeholder and | ||
a preset value if supplied during initialization. | ||
*/ | ||
render:function(){return this.$el.empty().append(this.template({name:this.name,placeholder:this.placeholder,value:this.value})),this.showClearButtonMaybe(),this.delegateEvents(),this}}),f=c.Extension.ClientSideFilter=e.extend({/** @property */ | ||
events:a.extend({},e.prototype.events,{"click a[data-backgrid-action=clear]":function(a){a.preventDefault(),this.clear()},"keydown input[type=search]":"search",submit:function(a){a.preventDefault(),this.search()}}),/** | ||
@property {?Array.<string>} [fields] A list of model field names to | ||
search for matches. If null, all of the fields will be searched. | ||
*/ | ||
fields:null,/** | ||
@property [wait=149] The time in milliseconds to wait since the last | ||
change to the search box's value before searching. This value can be | ||
adjusted depending on how often the search box is used and how large the | ||
search index is. | ||
*/ | ||
wait:149,/** | ||
Debounces the #search and #clear methods and makes a copy of the given | ||
collection for searching. | ||
@param {Object} options | ||
@param {Backbone.Collection} options.collection | ||
@param {string} [options.placeholder] | ||
@param {string} [options.fields] | ||
@param {string} [options.wait=149] | ||
*/ | ||
initialize:function(b){f.__super__.initialize.apply(this,arguments),this.fields=b.fields||this.fields,this.wait=b.wait||this.wait,this._debounceMethods(["search","clear"]);var c=this.collection=this.collection.fullCollection||this.collection,d=this.shadowCollection=c.clone();this.listenTo(c,"add",function(a,b,c){d.add(a,c)}),this.listenTo(c,"remove",function(a,b,c){d.remove(a,c)}),this.listenTo(c,"sort",function(a){this.query()||d.reset(a.models)}),this.listenTo(c,"reset",function(b,c){c=a.extend({reindex:!0},c||{}),c.reindex&&null==c.from&&null==c.to&&d.reset(b.models)})},_debounceMethods:function(b){a.isString(b)&&(b=[b]),this.undelegateEvents();for(var c=0,d=b.length;d>c;c++){var e=b[c],f=this[e];this[e]=a.debounce(f,this.wait)}this.delegateEvents()},/** | ||
Constructs a Javascript regular expression object for #makeMatcher. | ||
This default implementation takes a query string and returns a Javascript | ||
RegExp object that matches any of the words contained in the query string | ||
case-insensitively. Override this method to return a different regular | ||
expression matcher if this behavior is not desired. | ||
@param {string} query The search query in the search box. | ||
@return {RegExp} A RegExp object to match against model #fields. | ||
*/ | ||
makeRegExp:function(a){return new RegExp(a.trim().split(/\s+/).join("|"),"i")},/** | ||
This default implementation takes a query string and returns a matcher | ||
function that looks for matches in the model's #fields or all of its | ||
fields if #fields is null, for any of the words in the query | ||
case-insensitively using the regular expression object returned from | ||
#makeRegExp. | ||
Most of time, you'd want to override the regular expression used for | ||
matching. If so, please refer to the #makeRegExp documentation, | ||
otherwise, you can override this method to return a custom matching | ||
function. | ||
Subclasses overriding this method must take care to conform to the | ||
signature of the matcher function. The matcher function is a function | ||
that takes a model as paramter and returns true if the model matches a | ||
search, or false otherwise. | ||
In addition, when the matcher function is called, its context will be | ||
bound to this ClientSideFilter object so it has access to the filter's | ||
attributes and methods. | ||
@param {string} query The search query in the search box. | ||
@return {function(Backbone.Model):boolean} A matching function. | ||
*/ | ||
makeMatcher:function(a){var b=this.makeRegExp(a);return function(a){for(var c=this.fields||a.keys(),d=0,e=c.length;e>d;d++)if(b.test(a.get(c[d])+""))return!0;return!1}},/** | ||
Takes the query from the search box, constructs a matcher with it and | ||
loops through collection looking for matches. Reset the given collection | ||
when all the matches have been found. | ||
If the collection is a PageableCollection, searching will go back to the | ||
first page. | ||
*/ | ||
search:function(){var b=a.bind(this.makeMatcher(this.query()),this),c=this.collection;c.pageableCollection&&c.pageableCollection.getFirstPage({silent:!0}),c.reset(this.shadowCollection.filter(b),{reindex:!1})},/** | ||
Clears the search box and reset the collection to its original. | ||
If the collection is a PageableCollection, clearing will go back to the | ||
first page. | ||
*/ | ||
clear:function(){this.clearSearchBox();var a=this.collection;a.pageableCollection&&a.pageableCollection.getFirstPage({silent:!0}),a.reset(this.shadowCollection.models,{reindex:!1})}}),g=c.Extension.LunrFilter=f.extend({/** | ||
@property {string} [ref="id"]`lunrjs` document reference attribute name. | ||
*/ | ||
ref:"id",/** | ||
@property {Object} fields A hash of `lunrjs` index field names and boost | ||
value. Unlike ClientSideFilter#fields, LunrFilter#fields is _required_ to | ||
initialize the index. | ||
*/ | ||
fields:null,/** | ||
Indexes the underlying collection on construction. The index will refresh | ||
when the underlying collection is reset. If any model is added, removed | ||
or if any indexed fields of any models has changed, the index will be | ||
updated. | ||
@param {Object} options | ||
@param {Backbone.Collection} options.collection | ||
@param {string} [options.placeholder] | ||
@param {string} [options.ref] `lunrjs` document reference attribute name. | ||
@param {Object} [options.fields] A hash of `lunrjs` index field names and | ||
boost value. | ||
@param {number} [options.wait] | ||
*/ | ||
initialize:function(a){g.__super__.initialize.apply(this,arguments),this.ref=a.ref||this.ref;var b=this.collection=this.collection.fullCollection||this.collection;this.listenTo(b,"add",this.addToIndex),this.listenTo(b,"remove",this.removeFromIndex),this.listenTo(b,"reset",this.resetIndex),this.listenTo(b,"change",this.updateIndex),this.resetIndex(b)},/** | ||
Reindex the collection. If `options.reindex` is `false`, this method is a | ||
no-op. | ||
@param {Backbone.Collection} collection | ||
@param {Object} [options] | ||
@param {boolean} [options.reindex=true] | ||
*/ | ||
resetIndex:function(b,c){if(c=a.extend({reindex:!0},c||{}),c.reindex){var e=this;this.index=d(function(){a.each(e.fields,function(a,b){this.field(b,a),this.ref(e.ref)},this)}),b.each(function(a){this.addToIndex(a)},this)}},/** | ||
Adds the given model to the index. | ||
@param {Backbone.Model} model | ||
*/ | ||
addToIndex:function(a){var b=this.index,c=a.toJSON();b.documentStore.has(c[this.ref])?b.update(c):b.add(c)},/** | ||
Removes the given model from the index. | ||
@param {Backbone.Model} model | ||
*/ | ||
removeFromIndex:function(a){var b=this.index,c=a.toJSON();b.documentStore.has(c[this.ref])&&b.remove(c)},/** | ||
Updates the index for the given model. | ||
@param {Backbone.Model} model | ||
*/ | ||
updateIndex:function(b){var c=b.changedAttributes();c&&!a.isEmpty(a.intersection(a.keys(this.fields),a.keys(c)))&&this.index.update(b.toJSON())},/** | ||
Takes the query from the search box and performs a full-text search on | ||
the client-side. The search result is returned by resetting the | ||
underlying collection to the models after interrogating the index for the | ||
query answer. | ||
If the collection is a PageableCollection, searching will go back to the | ||
first page. | ||
*/ | ||
search:function(){var a=this.collection;if(!this.query())return void a.reset(this.shadowCollection.models,{reindex:!1});for(var b=this.index.search(this.query()),c=[],d=0;d<b.length;d++){var e=b[d];c.push(this.shadowCollection.get(e.ref))}a.pageableCollection&&a.pageableCollection.getFirstPage({silent:!0}),a.reset(c,{reindex:!1})}})}); |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ [ |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ Bug Report |
@@ -31,33 +31,10 @@ /* | ||
}, | ||
jasmine: { | ||
test: { | ||
version: "1.3.1", | ||
src: [ | ||
"backgrid-filter.js" | ||
], | ||
options: { | ||
specs: [ | ||
"test/filter.js" | ||
], | ||
template: require("grunt-template-jasmine-istanbul"), | ||
templateOptions: { | ||
coverage: "test/coverage/coverage.json", | ||
report: { | ||
type: "html", | ||
options: { | ||
dir: "test/coverage" | ||
} | ||
} | ||
}, | ||
vendor: [ | ||
"test/vendor/js/jquery.js", | ||
"test/vendor/js/underscore.js", | ||
"test/vendor/js/backbone.js", | ||
"test/vendor/js/backgrid.js", | ||
'test/vendor/js/lunr.js', | ||
'test/vendor/js/backbone-pageable.js' | ||
] | ||
} | ||
karma: { | ||
unit: { | ||
configFile: 'karma.conf.js', | ||
singleRun: true | ||
} | ||
}, | ||
jsduck: { | ||
@@ -76,2 +53,3 @@ main: { | ||
}, | ||
recess: { | ||
@@ -95,2 +73,3 @@ csslint: { | ||
}, | ||
uglify: { | ||
@@ -114,6 +93,6 @@ options: { | ||
grunt.loadNpmTasks("grunt-jsduck"); | ||
grunt.loadNpmTasks("grunt-contrib-jasmine"); | ||
grunt.loadNpmTasks("grunt-karma"); | ||
grunt.registerTask("dist", ["uglify", "recess"]); | ||
grunt.registerTask("default", ["clean", "jsduck", "dist", "jasmine"]); | ||
grunt.registerTask("default", ["clean", "jsduck", "dist", "karma"]); | ||
}; |
{ | ||
"name": "backgrid-filter", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "Search box widget extension for Backgrid.js. Supports server-side, client-side and full-text searching.", | ||
"main": "backgrid-filter.js", | ||
"scripts": { | ||
"test": "grunt jasmine" | ||
"test": "karma start --single-run --browsers Chrome,Firefox" | ||
}, | ||
@@ -24,15 +24,26 @@ "repository": { | ||
"devDependencies": { | ||
"grunt-contrib-clean": "~0.4.1", | ||
"grunt-jsduck": "~0.1.4", | ||
"grunt-contrib-uglify": "~0.2.2", | ||
"grunt-cli": "~0.1.9", | ||
"grunt": "~0.4.1", | ||
"grunt-recess": "~0.3.3", | ||
"grunt-template-jasmine-istanbul": "~0.2.4", | ||
"grunt-contrib-jasmine": "~0.5.1" | ||
"backbone.paginator": "^2.0.3", | ||
"grunt": "^0.4.5", | ||
"grunt-cli": "^0.1.13", | ||
"grunt-contrib-clean": "^1.0.0", | ||
"grunt-contrib-uglify": "^1.0.0", | ||
"grunt-jsduck": "^1.0.1", | ||
"grunt-karma": "^0.12.1", | ||
"grunt-recess": "^1.0.1", | ||
"jasmine-core": "^2.4.1", | ||
"jquery": "2.1.0", | ||
"karma": "^0.13.22", | ||
"karma-chrome-launcher": "^0.2.2", | ||
"karma-coverage": "^0.5.5", | ||
"karma-firefox-launcher": "^0.1.7", | ||
"karma-jasmine": "^0.3.7", | ||
"karma-jasmine-html-reporter": "^0.2.0", | ||
"karma-safari-launcher": "^0.1.1" | ||
}, | ||
"dependencies": { | ||
"lunr": "~0.4.3" | ||
}, | ||
"private": false | ||
"backbone": "~1.2.3", | ||
"backgrid": "~0.3.7", | ||
"lunr": "^0.7.0", | ||
"underscore": "^1.8.3" | ||
} | ||
} |
@@ -7,3 +7,3 @@ backgrid-filter | ||
============ | ||
[lunr >= 0.2.1](http://lunrjs.com) (LunrFilter) | ||
[lunr >= 0.7.0](http://lunrjs.com) (LunrFilter) | ||
@@ -10,0 +10,0 @@ Usage |
@@ -311,3 +311,3 @@ /* | ||
expect(filter.clearButton().css("display")).toBe("none"); | ||
collection.fetch.reset(); | ||
collection.fetch.calls.reset(); | ||
}); | ||
@@ -343,177 +343,132 @@ | ||
it("can perform a regex search on keydown and submit, and cancel on clicking the clear button", function () { | ||
var filter; | ||
it("can perform a regex search on keydown and submit, and cancel on clicking the clear button", function (done) { | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
runs(function () { | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
expect(collection.length).toBe(3); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
expect(collection.at(2).id).toBe(3); | ||
expect(collection.length).toBe(3); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
expect(collection.at(2).id).toBe(3); | ||
}); | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
runs(function () { | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(3); | ||
}); | ||
done(); | ||
runs(function () { | ||
filter.clearButton().click(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 3; | ||
}, "collection.length to become 3", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
expect(collection.at(2).id).toBe(3); | ||
}); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(3); | ||
runs(function () { | ||
filter.searchBox().val("ALICE"); | ||
filter.$el.submit(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(1); | ||
}); | ||
filter.clearButton().click(); | ||
runs(function () { | ||
filter.searchBox().val("al").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 2; | ||
}, "collection.length to become 2", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
}); | ||
done(); | ||
runs(function () { | ||
filter.searchBox().val("alic bob").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 3; | ||
}, "collection.length to become 3", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
expect(collection.at(2).id).toBe(3); | ||
}); | ||
expect(collection.length).toBe(3); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
expect(collection.at(2).id).toBe(3); | ||
filter.searchBox().val("ALICE"); | ||
filter.$el.submit(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(1); | ||
filter.searchBox().val("al").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(2); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
filter.searchBox().val("alic bob").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(3); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
expect(collection.at(2).id).toBe(3); | ||
}); | ||
it("will reflect in the search result when a new model is added to the collection", function () { | ||
var filter; | ||
runs(function () { | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
collection.add({id: 4, name: "doug"}); | ||
filter.searchBox().val("doug").keydown().keyup(); | ||
it("will reflect in the search result when a new model is added to the collection", function (done) { | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(4); | ||
}); | ||
filter.render(); | ||
collection.add({id: 4, name: "doug"}); | ||
filter.searchBox().val("doug").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(4); | ||
}); | ||
it("will reflect in the search result when a model is removed from the collection", function () { | ||
var filter; | ||
runs(function () { | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
collection.remove(collection.at(0)); | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
it("will reflect in the search result when a model is removed from the collection", function (done) { | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 0; | ||
}, "collection.length to become 0", 500); | ||
runs(function () { | ||
expect(filter.shadowCollection.length).toBe(2); | ||
expect(filter.shadowCollection.at(0).id).toBe(2); | ||
expect(filter.shadowCollection.at(1).id).toBe(3); | ||
}); | ||
filter.render(); | ||
collection.remove(collection.at(0)); | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
done() | ||
expect(collection.length).toBe(0); | ||
expect(filter.shadowCollection.length).toBe(2); | ||
expect(filter.shadowCollection.at(0).id).toBe(2); | ||
expect(filter.shadowCollection.at(1).id).toBe(3); | ||
}); | ||
it("will reflect in the search result when a model attribute is changed", function () { | ||
var filter; | ||
runs(function () { | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
filter.collection.at(0).set("name", "charlie"); | ||
filter.searchBox().val("charlie").keydown().keyup(); | ||
it("will reflect in the search result when a model attribute is changed", function (done) { | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
runs(function () { | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(0).get("name")).toBe("charlie"); | ||
expect(filter.collection.at(0).get("name")).toBe("charlie"); | ||
}); | ||
filter.render(); | ||
filter.collection.at(0).set("name", "charlie"); | ||
filter.searchBox().val("charlie").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(0).get("name")).toBe("charlie"); | ||
expect(filter.collection.at(0).get("name")).toBe("charlie"); | ||
}); | ||
it("will reflect in the search result when the collection is reset", function () { | ||
var filter; | ||
runs(function () { | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
filter.collection.reset([{id: 4, name: "charlie"}, {id: 5, name: "doug"}]); | ||
filter.searchBox().val("").keydown().keyup(); | ||
it("will reflect in the search result when the collection is reset", function (done) { | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 2; | ||
}, "collection.length to become 2", 500); | ||
runs(function () { | ||
expect(filter.shadowCollection.at(0).id).toBe(4); | ||
expect(filter.shadowCollection.at(1).id).toBe(5); | ||
expect(filter.shadowCollection.at(0).get("name")).toBe("charlie"); | ||
expect(filter.shadowCollection.at(1).get("name")).toBe("doug"); | ||
expect(filter.collection.at(0).id).toBe(4); | ||
expect(filter.collection.at(1).id).toBe(5); | ||
expect(filter.collection.at(0).get("name")).toBe("charlie"); | ||
expect(filter.collection.at(1).get("name")).toBe("doug"); | ||
}); | ||
filter.render(); | ||
filter.collection.reset([{id: 4, name: "charlie"}, {id: 5, name: "doug"}]); | ||
filter.searchBox().val("").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(2); | ||
expect(filter.shadowCollection.at(0).id).toBe(4); | ||
expect(filter.shadowCollection.at(1).id).toBe(5); | ||
expect(filter.shadowCollection.at(0).get("name")).toBe("charlie"); | ||
expect(filter.shadowCollection.at(1).get("name")).toBe("doug"); | ||
expect(filter.collection.at(0).id).toBe(4); | ||
expect(filter.collection.at(1).id).toBe(5); | ||
expect(filter.collection.at(0).get("name")).toBe("charlie"); | ||
expect(filter.collection.at(1).get("name")).toBe("doug"); | ||
}); | ||
it("goes back to the first page when the query changes", function () { | ||
var filter; | ||
runs(function () { | ||
collection = new Backbone.PageableCollection([ | ||
{id: 1, name: "alice"}, | ||
{id: 2, name: "bob"}], { | ||
it("goes back to the first page when the query changes", function (done) { | ||
collection = new Backbone.PageableCollection([ | ||
{id: 1, name: "alice"}, | ||
{id: 2, name: "bob"}], { | ||
state: { | ||
@@ -524,30 +479,26 @@ pageSize: 1, | ||
}); | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
collection.getPage(2); | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
waitsFor(function () { | ||
return collection.state.currentPage === 1; | ||
}, "collection.state.currentPage to become 1", 500); | ||
runs(function () { | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(1).id).toBe(2); | ||
expect(collection.state.currentPage).toBe(1); | ||
expect(collection.state.totalRecords).toBe(1); | ||
expect(collection.at(0).toJSON()).toEqual({id: 2, name: "bob"}); | ||
}); | ||
filter.render(); | ||
collection.getPage(2); | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
done(); | ||
expect(collection.state.currentPage).toBe(1); | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(1).id).toBe(2); | ||
expect(collection.state.currentPage).toBe(1); | ||
expect(collection.state.totalRecords).toBe(1); | ||
expect(collection.at(0).toJSON()).toEqual({id: 2, name: "bob"}); | ||
}); | ||
it("goes back to the first page when the clear button was clicked", function () { | ||
var filter; | ||
runs(function () { | ||
collection = new Backbone.PageableCollection([ | ||
{id: 1, name: "alice"}, | ||
{id: 2, name: "amanda"}], { | ||
it("goes back to the first page when the clear button was clicked", function (done) { | ||
collection = new Backbone.PageableCollection([ | ||
{id: 1, name: "alice"}, | ||
{id: 2, name: "amanda"}], { | ||
state: { | ||
@@ -558,84 +509,65 @@ pageSize: 1, | ||
}); | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
filter.searchBox().val("a").keydown().keyup(); | ||
collection.getPage(2); | ||
filter.clearButton().click(); | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
waitsFor(function () { | ||
return collection.state.currentPage === 1; | ||
}, "collection.state.currentPage to become 1", 500); | ||
runs(function () { | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(1).id).toBe(2); | ||
expect(collection.state.totalRecords).toBe(2); | ||
expect(collection.at(0).toJSON()).toEqual({id: 1, name: "alice"}); | ||
}); | ||
}); | ||
filter.render(); | ||
filter.searchBox().val("a").keydown().keyup(); | ||
collection.getPage(2); | ||
filter.clearButton().click(); | ||
it("can clear the search box and reset the collection when the clear button is clicked", function () { | ||
var filter; | ||
done(); | ||
runs(function () { | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
}); | ||
expect(collection.state.currentPage).toBe(1); | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(1).id).toBe(2); | ||
expect(collection.state.totalRecords).toBe(2); | ||
expect(collection.at(0).toJSON()).toEqual({id: 1, name: "alice"}); | ||
}); | ||
runs(function() { | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
it("can clear the search box and reset the collection when the clear button is clicked", function (done) { | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
filter.render(); | ||
runs(function () { | ||
filter.clearButton().click(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 3; | ||
}, "collection.length to become 2", 500); | ||
runs(function () { | ||
expect(filter.searchBox().val()).toBe(''); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
expect(collection.at(2).id).toBe(3); | ||
}); | ||
}); | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
it("shows the clear button when the search box has text entered, hides it otherwise", function () { | ||
var filter; | ||
done(); | ||
runs(function () { | ||
filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
}); | ||
expect(collection.length).toBe(1); | ||
waitsFor(function () { | ||
return collection.length == 1; | ||
}, "collection.length to become 1", 500); | ||
filter.clearButton().click(); | ||
runs(function() { | ||
expect(filter.clearButton().css("display")).not.toBe("none"); | ||
filter.searchBox().val(null).keydown().keyup(); | ||
}); | ||
done(); | ||
waitsFor(function () { | ||
return collection.length == 3; | ||
}, "collection.length to become 3", 500); | ||
expect(collection.length).toBe(3); | ||
expect(filter.searchBox().val()).toBe(''); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
expect(collection.at(2).id).toBe(3); | ||
}); | ||
runs(function() { | ||
expect(filter.clearButton().css("display")).toBe("none"); | ||
it("shows the clear button when the search box has text entered, hides it otherwise", function (done) { | ||
var filter = new Backgrid.Extension.ClientSideFilter({ | ||
collection: collection, | ||
fields: ["name"] | ||
}); | ||
filter.render(); | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(filter.clearButton().css("display")).not.toBe("none"); | ||
filter.searchBox().val(null).keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(3); | ||
expect(filter.clearButton().css("display")).toBe("none"); | ||
}); | ||
@@ -656,61 +588,44 @@ | ||
it("can perform a full-text search on keydown and submit, and cancel on clicking the clear button", function () { | ||
var filter; | ||
runs(function () { | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
expect(collection.length).toBe(2); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
it("can perform a full-text search on keydown and submit, and cancel on clicking the clear button", function (done) { | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
expect(collection.length).toBe(2); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
runs(function () { | ||
filter.searchBox().val("crap").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(2); | ||
}); | ||
runs(function () { | ||
filter.clearButton().click(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 2; | ||
}, "collection.length to become 2", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
}); | ||
filter.searchBox().val("crap").keydown().keyup(); | ||
done(); | ||
runs(function () { | ||
filter.searchBox().val("alice"); | ||
filter.$el.submit(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(1); | ||
}); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(2); | ||
runs(function () { | ||
filter.searchBox().val("fat").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 2; | ||
}, "collection.length to become 2", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(2); | ||
expect(collection.at(1).id).toBe(1); | ||
}); | ||
filter.clearButton().click(); | ||
done(); | ||
expect(collection.length).toBe(2); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
filter.searchBox().val("alice"); | ||
filter.$el.submit(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(1); | ||
filter.searchBox().val("fat").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(2); | ||
expect(collection.at(0).id).toBe(2); | ||
expect(collection.at(1).id).toBe(1); | ||
}); | ||
it("will reindex on reset", function () { | ||
it("will reindex on reset", function (done) { | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
@@ -721,256 +636,202 @@ collection: collection, | ||
runs(function () { | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
collection.reset([{id: 3, name: "charlie", bio: "The cat scared the bat and sat on the mat."}, | ||
{id: 4, name: "doug", bio: "The snail hid in his shell. It heard a bell. He went to see it was the church bell."}]); | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
collection.reset([{id: 3, name: "charlie", bio: "The cat scared the bat and sat on the mat."}, | ||
{id: 4, name: "doug", bio: "The snail hid in his shell. It heard a bell. He went to see it was the church bell."}]); | ||
runs(function () { | ||
filter.searchBox().val("crap").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 0; | ||
}, "collection.length to become 0", 500); | ||
filter.searchBox().val("crap").keydown().keyup(); | ||
runs(function () { | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 0; | ||
}, "collection.length to become 0", 500); | ||
done(); | ||
runs(function () { | ||
filter.searchBox().val("charlie").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(3); | ||
}); | ||
expect(collection.length).toBe(0); | ||
runs(function () { | ||
filter.searchBox().val("doug").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1 && collection.at(0).id === 4; | ||
}, "colleciton.length to become 1 and collection.at(0).id to become 4", 500); | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(0); | ||
filter.searchBox().val("charlie").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(3); | ||
filter.searchBox().val("doug").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(4); | ||
}); | ||
it("will update the index on add", function () { | ||
var filter; | ||
runs(function () { | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
collection.add({id: 3, name: "charlie", bio: "The cat scared the bat and sat on the mat."}); | ||
it("will update the index on add", function (done) { | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
collection.add({id: 3, name: "charlie", bio: "The cat scared the bat and sat on the mat."}); | ||
runs(function () { | ||
filter.searchBox().val("charlie").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 0", 500); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(3); | ||
}); | ||
filter.searchBox().val("charlie").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(3); | ||
}); | ||
it("will update the index on remove", function () { | ||
var filter; | ||
runs(function () { | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
collection.remove(collection.last()); | ||
it("will update the index on remove", function (done) { | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
collection.remove(collection.last()); | ||
runs(function () { | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 0; | ||
}, "collection.length to become 0", 500); | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
runs(function () { | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(1); | ||
}); | ||
}); | ||
done(); | ||
it("will update the index on change", function () { | ||
var filter; | ||
expect(collection.length).toBe(0); | ||
runs(function () { | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
collection.at(0).set("name", "charlie"); | ||
}); | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
runs(function () { | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 0; | ||
}, "collection.length to become 0", 500); | ||
done(); | ||
runs(function () { | ||
filter.searchBox().val("charlie").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(1); | ||
}); | ||
runs(function () { | ||
expect(collection.at(0).id).toBe(1); | ||
it("will update the index on change", function (done) { | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
}); | ||
filter.render(); | ||
collection.at(0).set("name", "charlie"); | ||
it("goes back to the first page when the query changes", function () { | ||
var filter; | ||
filter.searchBox().val("alice").keydown().keyup(); | ||
runs(function () { | ||
collection = new Backbone.PageableCollection([ | ||
{id: 1, name: "alice", bio: "a fat cat sat on a mat and ate a fat rat"}, | ||
{id: 2, name: "bob", bio: "he is fat but does not crap"} | ||
], { | ||
state: { | ||
pageSize: 1, | ||
}, | ||
mode: "client" | ||
}); | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
collection.getPage(2); | ||
filter.searchBox().val("fat").keydown().keyup(); | ||
}); | ||
waitsFor(function () { | ||
return collection.state.currentPage === 1; | ||
}, "collection.state.currentPage to become 1", 500); | ||
runs(function () { | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(1).id).toBe(2); | ||
expect(collection.state.currentPage).toBe(1); | ||
expect(collection.state.totalRecords).toBe(2); | ||
expect(collection.at(0).id).toBe(2); | ||
}); | ||
}); | ||
done(); | ||
it("goes back to the first page when the clear button was clicked", function () { | ||
var filter; | ||
expect(collection.length).toBe(0); | ||
runs(function () { | ||
collection = new Backbone.PageableCollection([ | ||
{id: 1, name: "alice", bio: "a fat cat sat on a mat and ate a fat rat"}, | ||
{id: 2, name: "bob", bio: "he is fat but does not crap"} | ||
], { | ||
state: { | ||
pageSize: 1, | ||
}, | ||
mode: "client" | ||
}); | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
filter.searchBox().val("fat").keydown().keyup(); | ||
collection.getPage(2); | ||
filter.clearButton().click(); | ||
}); | ||
waitsFor(function () { | ||
return collection.state.currentPage === 1; | ||
}, "collection.state.currentPage to become 1", 500); | ||
runs(function () { | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(1).id).toBe(2); | ||
expect(collection.state.totalRecords).toBe(2); | ||
expect(collection.at(0).id).toBe(1); | ||
}); | ||
filter.searchBox().val("charlie").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(collection.at(0).id).toBe(1); | ||
}); | ||
it("can clear the search box and reindex upon clicking the clear button", function () { | ||
var filter; | ||
runs(function () { | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
it("goes back to the first page when the query changes", function (done) { | ||
collection = new Backbone.PageableCollection([ | ||
{id: 1, name: "alice", bio: "a fat cat sat on a mat and ate a fat rat"}, | ||
{id: 2, name: "bob", bio: "he is fat but does not crap"} | ||
], { | ||
state: { | ||
pageSize: 1, | ||
}, | ||
mode: "client" | ||
}); | ||
runs(function() { | ||
filter.searchBox().val("crap").keydown().keyup(); | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 1; | ||
}, "collection.length to become 1", 500); | ||
filter.render(); | ||
collection.getPage(2); | ||
filter.searchBox().val("fat").keydown().keyup(); | ||
runs(function () { | ||
filter.clearButton().click(); | ||
}); | ||
waitsFor(function () { | ||
return collection.length === 2; | ||
}, "collection.length to become 2", 500); | ||
runs(function () { | ||
expect(filter.searchBox().val()).toBe(''); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
}); | ||
done(); | ||
expect(collection.state.currentPage).toBe(1); | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(1).id).toBe(2); | ||
expect(collection.state.currentPage).toBe(1); | ||
expect(collection.state.totalRecords).toBe(2); | ||
expect(collection.at(0).id).toBe(2); | ||
}); | ||
it("shows the clear button when the search box has text entered, hides it otherwise", function () { | ||
var filter; | ||
it("goes back to the first page when the clear button was clicked", function (done) { | ||
collection = new Backbone.PageableCollection([ | ||
{id: 1, name: "alice", bio: "a fat cat sat on a mat and ate a fat rat"}, | ||
{id: 2, name: "bob", bio: "he is fat but does not crap"} | ||
], { | ||
state: { | ||
pageSize: 1, | ||
}, | ||
mode: "client" | ||
}); | ||
runs(function () { | ||
filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
filter.searchBox().val("fat").keydown().keyup(); | ||
collection.getPage(2); | ||
filter.clearButton().click(); | ||
waitsFor(function () { | ||
return collection.length == 1; | ||
}, "collection.length to become 1", 500); | ||
done(); | ||
runs(function() { | ||
expect(filter.clearButton().css("display")).not.toBe("none"); | ||
filter.searchBox().val(null).keydown().keyup(); | ||
expect(collection.state.currentPage).toBe(1); | ||
expect(collection.length).toBe(1); | ||
expect(filter.shadowCollection.at(0).id).toBe(1); | ||
expect(filter.shadowCollection.at(1).id).toBe(2); | ||
expect(collection.state.totalRecords).toBe(2); | ||
expect(collection.at(0).id).toBe(1); | ||
}); | ||
it("can clear the search box and reindex upon clicking the clear button", function (done) { | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
waitsFor(function () { | ||
return collection.length == 2; | ||
}, "collection.length to become 2", 500); | ||
filter.searchBox().val("crap").keydown().keyup(); | ||
runs(function() { | ||
expect(filter.clearButton().css("display")).toBe("none"); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
filter.clearButton().click(); | ||
done(); | ||
expect(collection.length).toBe(2); | ||
expect(filter.searchBox().val()).toBe(''); | ||
expect(collection.at(0).id).toBe(1); | ||
expect(collection.at(1).id).toBe(2); | ||
}); | ||
it("shows the clear button when the search box has text entered, hides it otherwise", function (done) { | ||
var filter = new Backgrid.Extension.LunrFilter({ | ||
collection: collection, | ||
fields: {name: 1, bio: 10} | ||
}); | ||
filter.render(); | ||
filter.searchBox().val("bob").keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(1); | ||
expect(filter.clearButton().css("display")).not.toBe("none"); | ||
filter.searchBox().val(null).keydown().keyup(); | ||
done(); | ||
expect(collection.length).toBe(2); | ||
expect(filter.clearButton().css("display")).toBe("none"); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
478
3095376
4
17
4335
3
+ Addedbackbone@~1.2.3
+ Addedbackgrid@~0.3.7
+ Addedunderscore@^1.8.3
+ Addedbackbone@1.2.3(transitive)
+ Addedbackgrid@0.3.8(transitive)
+ Addedlunr@0.7.2(transitive)
+ Addedunderscore@1.13.7(transitive)
- Removedlunr@0.4.5(transitive)
Updatedlunr@^0.7.0