diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f674b50..e6a5bee 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ Feature Request Please search the issue list first to see if your feature has already been requested. All features are tagged with the tag `enhancement`. If there already -is an enchancement ticket, you can vote on it by putting in a +/-1 comment. If +is an enhancement ticket, you can vote on it by putting in a +/-1 comment. If you cannot find the `enhancement` you are looking for, you can open a new issue. Please prefix the subject line with **[Feature Request]** so your issue will @@ -64,13 +64,13 @@ Code Style ========== If you are filing a pull request, you should follow the guidelines below: -Javascript +JavaScript ---------- Please be aware that Backgrid.js uses 2 spaces for indentation. This project has a [.jshintrc](.jshintrc) file defined, which is handy if you use [jshint](http://www.jshint.com). In general, you should follow the -[Google Javascript Style Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml). Backgrid.js's +[Google JavaScript Style Guide](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml). Backgrid.js's code follows this coding style extremely closely, with 2 exceptions: - `else` should be on its own line instead of the same line of the close `}` of @@ -107,10 +107,10 @@ Documentation ============= If you make any changes to the documentation, since Backgrid.js uses -[Github Pages](http://pages.github.com), please do so in your `gh-pages` branch +[GitHub Pages](http://pages.github.com), please do so in your `gh-pages` branch and submit a pull request from that branch. -If you change any Javascript comment documentation, you should rebuild the API +If you change any JavaScript comment documentation, you should rebuild the API document. There is also a Grunt task for this purpose, but make sure you have installed [JSDuck](https://github.com/senchalabs/jsduck) first. diff --git a/api/output/Backgrid.Extension.ClientSideFilter.js b/api/output/Backgrid.Extension.ClientSideFilter.js index c673d6f..ed2b52a 100644 --- a/api/output/Backgrid.Extension.ClientSideFilter.js +++ b/api/output/Backgrid.Extension.ClientSideFilter.js @@ -246,5 +246,5 @@ Ext.data.JsonP.Backgrid_Extension_ClientSideFilter({ "parentMixins": [ ], - "html": "

Hierarchy

Backgrid.Extension.ServerSideFilter
Backgrid.Extension.ClientSideFilter

Subclasses

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.

\n
Defined By

Properties

...
\n

Defaults to: "backgrid-filter form-search"

Backgrid.Extension.ClientSideFilter
events : Object
Backgrid.Extension.ClientSideFilter
: ?Array.<string>
A list of model field names to\nsearch for matches. ...

A list of model field names to\nsearch for matches. If null, all of the fields will be searched.

\n
Query key ...

Query key

\n

Defaults to: 'q'

The HTML5 placeholder to appear beneath\nthe search box.

\n

The HTML5 placeholder to appear beneath\nthe search box.

\n
...
\n

Defaults to: "form"

template : function(Object, ?Object=): string
\n
\n

The search box value.

\n

The search box value.

\n
Backgrid.Extension.ClientSideFilter
: Number
The time in milliseconds to wait since the last\nchange to the search box's value before searching. ...

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.

\n

Defaults to: 149

Defined By

Methods

Backgrid.Extension.ClientSideFilter
( )
Clears the search box and reset the collection to its original. ...

Clears the search box and reset the collection to its original.

\n\n

If the collection is a PageableCollection, clearing will go back to the\nfirst page.

\n

Overrides: Backgrid.Extension.ServerSideFilter.clear

Returns the clear button. ...

Returns the clear button.

\n
Event handler. ...

Event handler. Clear the search box and reset the internal search value.

\n
Backgrid.Extension.ClientSideFilter
( options )
Debounces the search and clear methods and makes a copy of the given\ncollection for searching. ...

Debounces the search and clear methods and makes a copy of the given\ncollection for searching.

\n

Parameters

  • options : Object
    \n
    • collection : Backbone.Collection
    • placeholder : string (optional)
    • fields : string (optional)
    • wait : string (optional)

      Defaults to: 149

Overrides: Backgrid.Extension.ServerSideFilter.initialize

Backgrid.Extension.ClientSideFilter
( query ) : function(Backbone.Model):boolean
This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's...

This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's fields or all of its\nfields if fields is null, for any of the words in the query\ncase-insensitively using the regular expression object returned from

\n\n

makeRegExp.

\n\n

Most of time, you'd want to override the regular expression used for\nmatching. If so, please refer to the makeRegExp documentation,\notherwise, you can override this method to return a custom matching\nfunction.

\n\n

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.

\n\n

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.

\n

Parameters

  • query : string

    The search query in the search box.

    \n

Returns

  • function(Backbone.Model):boolean

    A matching function.

    \n
Backgrid.Extension.ClientSideFilter
( query ) : RegExp
Constructs a Javascript regular expression object for makeMatcher. ...

Constructs a Javascript regular expression object for makeMatcher.

\n\n

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.

\n

Parameters

  • query : string

    The search query in the search box.

    \n

Returns

  • RegExp

    A RegExp object to match against model fields.

    \n
Returns the current search query. ...

Returns the current search query.

\n
Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...

Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.

\n

Returns

Event handler. ...

Event handler. Show the clear button when the search box has text, hide\nit otherwise.

\n
" + "html": "

Hierarchy

Backgrid.Extension.ServerSideFilter
Backgrid.Extension.ClientSideFilter

Subclasses

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 overridden by subclasses.

\n
Defined By

Properties

...
\n

Defaults to: "backgrid-filter form-search"

Backgrid.Extension.ClientSideFilter
events : Object
Backgrid.Extension.ClientSideFilter
: ?Array.<string>
A list of model field names to\nsearch for matches. ...

A list of model field names to\nsearch for matches. If null, all of the fields will be searched.

\n
Query key ...

Query key

\n

Defaults to: 'q'

The HTML5 placeholder to appear beneath\nthe search box.

\n

The HTML5 placeholder to appear beneath\nthe search box.

\n
...
\n

Defaults to: "form"

template : function(Object, ?Object=): string
\n
\n

The search box value.

\n

The search box value.

\n
Backgrid.Extension.ClientSideFilter
: Number
The time in milliseconds to wait since the last\nchange to the search box's value before searching. ...

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.

\n

Defaults to: 149

Defined By

Methods

Backgrid.Extension.ClientSideFilter
( )
Clears the search box and reset the collection to its original. ...

Clears the search box and reset the collection to its original.

\n\n

If the collection is a PageableCollection, clearing will go back to the\nfirst page.

\n

Overrides: Backgrid.Extension.ServerSideFilter.clear

Returns the clear button. ...

Returns the clear button.

\n
Event handler. ...

Event handler. Clear the search box and reset the internal search value.

\n
Backgrid.Extension.ClientSideFilter
( options )
Debounces the search and clear methods and makes a copy of the given\ncollection for searching. ...

Debounces the search and clear methods and makes a copy of the given\ncollection for searching.

\n

Parameters

  • options : Object
    \n
    • collection : Backbone.Collection
    • placeholder : string (optional)
    • fields : string (optional)
    • wait : string (optional)

      Defaults to: 149

Overrides: Backgrid.Extension.ServerSideFilter.initialize

Backgrid.Extension.ClientSideFilter
( query ) : function(Backbone.Model):boolean
This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's...

This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's fields or all of its\nfields if fields is null, for any of the words in the query\ncase-insensitively using the regular expression object returned from

\n\n

makeRegExp.

\n\n

Most of time, you'd want to override the regular expression used for\nmatching. If so, please refer to the makeRegExp documentation,\notherwise, you can override this method to return a custom matching\nfunction.

\n\n

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 parameter and returns true if the model matches a\nsearch, or false otherwise.

\n\n

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.

\n

Parameters

  • query : string

    The search query in the search box.

    \n

Returns

  • function(Backbone.Model):boolean

    A matching function.

    \n
Backgrid.Extension.ClientSideFilter
( query ) : RegExp
Constructs a JavaScript regular expression object for makeMatcher. ...

Constructs a JavaScript regular expression object for makeMatcher.

\n\n

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.

\n

Parameters

  • query : string

    The search query in the search box.

    \n

Returns

  • RegExp

    A RegExp object to match against model fields.

    \n
Returns the current search query. ...

Returns the current search query.

\n
Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...

Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.

\n

Returns

Event handler. ...

Event handler. Show the clear button when the search box has text, hide\nit otherwise.

\n
" }); \ No newline at end of file diff --git a/api/output/Backgrid.Extension.LunrFilter.js b/api/output/Backgrid.Extension.LunrFilter.js index 071b942..7c8bec0 100644 --- a/api/output/Backgrid.Extension.LunrFilter.js +++ b/api/output/Backgrid.Extension.LunrFilter.js @@ -287,5 +287,5 @@ Ext.data.JsonP.Backgrid_Extension_LunrFilter({ "parentMixins": [ ], - "html": "

Hierarchy

LunrFilter is a ClientSideFilter that uses lunrjs to\nindex the text fields of each model for a collection, and performs\nfull-text searching.

\n
Defined By

Properties

...
\n

Defaults to: "backgrid-filter form-search"

Backgrid.Extension.LunrFilter
: Object
A hash of lunrjs index field names and boost\nvalue. ...

A hash of lunrjs index field names and boost\nvalue. Unlike ClientSideFilter#fields, LunrFilter#fields is required to\ninitialize the index.

\n

Overrides: Backgrid.Extension.ClientSideFilter.fields

Query key ...

Query key

\n

Defaults to: 'q'

The HTML5 placeholder to appear beneath\nthe search box.

\n

The HTML5 placeholder to appear beneath\nthe search box.

\n
Backgrid.Extension.LunrFilter
: string
`lunrjs` document reference attribute name. ...

`lunrjs` document reference attribute name.

\n

Defaults to: "id"

...
\n

Defaults to: "form"

template : function(Object, ?Object=): string
\n
\n

The search box value.

\n

The search box value.

\n
The time in milliseconds to wait since the last\nchange to the search box's value before searching. ...

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.

\n

Defaults to: 149

Defined By

Methods

Backgrid.Extension.LunrFilter
( model )
Adds the given model to the index. ...

Adds the given model to the index.

\n

Parameters

  • model : Backbone.Model
    \n
Clears the search box and reset the collection to its original. ...

Clears the search box and reset the collection to its original.

\n\n

If the collection is a PageableCollection, clearing will go back to the\nfirst page.

\n

Overrides: Backgrid.Extension.ServerSideFilter.clear

Returns the clear button. ...

Returns the clear button.

\n
Event handler. ...

Event handler. Clear the search box and reset the internal search value.

\n
Backgrid.Extension.LunrFilter
( options )
Indexes the underlying collection on construction. ...

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.

\n

Parameters

  • options : Object
    \n
    • collection : Backbone.Collection
    • placeholder : string (optional)
    • ref : string (optional)

      `lunrjs` document reference attribute name.

      \n
    • fields : Object (optional)

      A hash of lunrjs index field names and\nboost value.

      \n
    • wait : number (optional)

Overrides: Backgrid.Extension.ClientSideFilter.initialize

( query ) : function(Backbone.Model):boolean
This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's...

This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's fields or all of its\nfields if fields is null, for any of the words in the query\ncase-insensitively using the regular expression object returned from

\n\n

makeRegExp.

\n\n

Most of time, you'd want to override the regular expression used for\nmatching. If so, please refer to the makeRegExp documentation,\notherwise, you can override this method to return a custom matching\nfunction.

\n\n

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.

\n\n

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.

\n

Parameters

  • query : string

    The search query in the search box.

    \n

Returns

  • function(Backbone.Model):boolean

    A matching function.

    \n
Constructs a Javascript regular expression object for makeMatcher. ...

Constructs a Javascript regular expression object for makeMatcher.

\n\n

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.

\n

Parameters

  • query : string

    The search query in the search box.

    \n

Returns

  • RegExp

    A RegExp object to match against model fields.

    \n
Returns the current search query. ...

Returns the current search query.

\n
Backgrid.Extension.LunrFilter
( model )
Removes the given model from the index. ...

Removes the given model from the index.

\n

Parameters

  • model : Backbone.Model
    \n
Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...

Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.

\n

Returns

Backgrid.Extension.LunrFilter
( collection, [options] )
Reindex the collection. ...

Reindex the collection. If options.reindex is false, this method is a\nno-op.

\n

Parameters

  • collection : Backbone.Collection
    \n
  • options : Object (optional)
    \n
    • reindex : boolean (optional)

      Defaults to: true

Event handler. ...

Event handler. Show the clear button when the search box has text, hide\nit otherwise.

\n
Backgrid.Extension.LunrFilter
( model )
Updates the index for the given model. ...

Updates the index for the given model.

\n

Parameters

  • model : Backbone.Model
    \n
" + "html": "

Hierarchy

LunrFilter is a ClientSideFilter that uses lunrjs to\nindex the text fields of each model for a collection, and performs\nfull-text searching.

\n
Defined By

Properties

...
\n

Defaults to: "backgrid-filter form-search"

Backgrid.Extension.LunrFilter
: Object
A hash of lunrjs index field names and boost\nvalue. ...

A hash of lunrjs index field names and boost\nvalue. Unlike ClientSideFilter#fields, LunrFilter#fields is required to\ninitialize the index.

\n

Overrides: Backgrid.Extension.ClientSideFilter.fields

Query key ...

Query key

\n

Defaults to: 'q'

The HTML5 placeholder to appear beneath\nthe search box.

\n

The HTML5 placeholder to appear beneath\nthe search box.

\n
Backgrid.Extension.LunrFilter
: string
`lunrjs` document reference attribute name. ...

`lunrjs` document reference attribute name.

\n

Defaults to: "id"

...
\n

Defaults to: "form"

template : function(Object, ?Object=): string
\n
\n

The search box value.

\n

The search box value.

\n
The time in milliseconds to wait since the last\nchange to the search box's value before searching. ...

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.

\n

Defaults to: 149

Defined By

Methods

Backgrid.Extension.LunrFilter
( model )
Adds the given model to the index. ...

Adds the given model to the index.

\n

Parameters

  • model : Backbone.Model
    \n
Clears the search box and reset the collection to its original. ...

Clears the search box and reset the collection to its original.

\n\n

If the collection is a PageableCollection, clearing will go back to the\nfirst page.

\n

Overrides: Backgrid.Extension.ServerSideFilter.clear

Returns the clear button. ...

Returns the clear button.

\n
Event handler. ...

Event handler. Clear the search box and reset the internal search value.

\n
Backgrid.Extension.LunrFilter
( options )
Indexes the underlying collection on construction. ...

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.

\n

Parameters

  • options : Object
    \n
    • collection : Backbone.Collection
    • placeholder : string (optional)
    • ref : string (optional)

      `lunrjs` document reference attribute name.

      \n
    • fields : Object (optional)

      A hash of lunrjs index field names and\nboost value.

      \n
    • wait : number (optional)

Overrides: Backgrid.Extension.ClientSideFilter.initialize

( query ) : function(Backbone.Model):boolean
This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's...

This default implementation takes a query string and returns a matcher\nfunction that looks for matches in the model's fields or all of its\nfields if fields is null, for any of the words in the query\ncase-insensitively using the regular expression object returned from

\n\n

makeRegExp.

\n\n

Most of time, you'd want to override the regular expression used for\nmatching. If so, please refer to the makeRegExp documentation,\notherwise, you can override this method to return a custom matching\nfunction.

\n\n

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 parameter and returns true if the model matches a\nsearch, or false otherwise.

\n\n

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.

\n

Parameters

  • query : string

    The search query in the search box.

    \n

Returns

  • function(Backbone.Model):boolean

    A matching function.

    \n
Constructs a JavaScript regular expression object for makeMatcher. ...

Constructs a JavaScript regular expression object for makeMatcher.

\n\n

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.

\n

Parameters

  • query : string

    The search query in the search box.

    \n

Returns

  • RegExp

    A RegExp object to match against model fields.

    \n
Returns the current search query. ...

Returns the current search query.

\n
Backgrid.Extension.LunrFilter
( model )
Removes the given model from the index. ...

Removes the given model from the index.

\n

Parameters

  • model : Backbone.Model
    \n
Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initializa...

Renders a search form with a text box, optionally with a placeholder and\na preset value if supplied during initialization.

\n

Returns

Backgrid.Extension.LunrFilter
( collection, [options] )
Reindex the collection. ...

Reindex the collection. If options.reindex is false, this method is a\nno-op.

\n

Parameters

  • collection : Backbone.Collection
    \n
  • options : Object (optional)
    \n
    • reindex : boolean (optional)

      Defaults to: true

Event handler. ...

Event handler. Show the clear button when the search box has text, hide\nit otherwise.

\n
Backgrid.Extension.LunrFilter
( model )
Updates the index for the given model. ...

Updates the index for the given model.

\n

Parameters

  • model : Backbone.Model
    \n
" }); \ No newline at end of file diff --git a/backgrid-filter.js b/backgrid-filter.js index 4642232..5e8bbac 100644 --- a/backgrid-filter.js +++ b/backgrid-filter.js @@ -219,7 +219,7 @@ /** ClientSideFilter is a search form widget that searches a collection for model matches against a query on the client side. The exact matching - algorithm can be overriden by subclasses. + algorithm can be overridden by subclasses. @class Backgrid.Extension.ClientSideFilter @extends Backgrid.Extension.ServerSideFilter @@ -306,9 +306,9 @@ }, /** - Constructs a Javascript regular expression object for #makeMatcher. + Constructs a JavaScript regular expression object for #makeMatcher. - This default implementation takes a query string and returns a Javascript + 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. @@ -334,7 +334,7 @@ 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 + that takes a model as parameter and returns true if the model matches a search, or false otherwise. In addition, when the matcher function is called, its context will be