Constructor
new QueryBuilderView()
- Since:
- Source:
Extends
Members
An ID for the element in the template that a user should click to add a new
rule. A unique ID will be appended to this ID, and the ID will be added to the
template.
Type:
- Since:
- Source:
An ID for the element in the template that a user should click to add a new
rule group. A unique ID will be appended to this ID, and the ID will be added
to the template.
Type:
- Since:
- Source:
className :string
The HTML class names for this view element
Type:
- Source:
A Filters collection that stores filters to be edited with this Query Builder,
e.g. the definitionFilters in a Collection or Portal model. If a filterGroup is
set, then collection doesn't necessarily need to be set, as the Filters
collection from within the FilterGroup model will automatically be set on view.
Type:
- Source:
excludeFields :Array.<string>
Query fields to exclude in the metadata field selector of each Query Rule. This
is a list of field names that exist in the query service index (i.e. Solr), but
which should be hidden in the Query Builder
Type:
- Source:
A JQuery selector for the element in the template that will contain the input
allowing a user to switch the exclude attribute from "include" to "exclude"
(i.e. to switch between exclude:false and exclude:true in the filterGroup
model.)
Type:
- Since:
- Source:
The FilterGroup model that stores the filters, the exclude attribute, and the
group operator to be edited with this Query Builder. This does not need to be
set; just a Filters collection can be set on the view instead, but then there
will be no input to switch between the include & exclude and any & all, since
these are the exclude and operator attributes on the filterGroup model.
Type:
- Since:
- Source:
nestedExcludeFields :Array.<string>
Query fields to exclude in the metadata field selector for any Query Rules that
are in nested Query Builders (i.e. in nested Filter Groups). This is a list of
field names that exist in the query service index (i.e. Solr), but which should
be hidden in nested Query Builders
Type:
- Source:
nestedLevelsAllowed :number
The maximum number of levels nested Rule Groups (i.e. nested FilterGroup
models) that a user is permitted to *build* in the Query Builder. If a
Portal/Collection document is loaded into the Query Builder that has more than
the maximum allowable nested levels, those levels will still be displayed. This
only prevents the "Add Rule Group" button from being shown.
Type:
- Since:
- Source:
A JQuery selector for the element in the template that will contain the input
allowing a user to switch the operator from "all" to "any" (i.e. to switch
between operator:"AND" and exclude:"OR" in the filterGroup model.)
Type:
- Since:
- Source:
ruleColorPalette :Array.<string>
An array of hex color codes used to help distinguish between different rules
Type:
- Source:
The list of QueryRuleViews that are contained within this queryBuilder
Type:
- Source:
rulesContainerSelector :string
A JQuery selector for the element in the template that will contain the query
rules
Type:
- Source:
Query fields that do not exist in the query service index, but which we would
like to show as options in the Query Builder field input.
Type:
- Since:
- Source:
template :Underscore.template
The primary HTML template for this view
Type:
- Source:
type :string
The type of View this is
Type:
- Source:
Methods
addQueryRule(filterModel)
Appends a new row (Query Rule View) to the end of the Query Builder
Parameters:
Name |
Type |
Description |
filterModel |
Filter
|
FilterGroup
|
The Filter model or FilterGroup model
for which to create a rule. If none is provided, then a Filter group model
will be created and added to the collection. |
- Source:
addQueryRuleGroup(filterGroupModel)
Exactly the same as
QueryBuilderView#addQueryRule, except that if no
model is provided to this function, then a FilterGroup model will be created
instead of a Filter model.
Parameters:
- Source:
events() → {Object}
events - A function that specifies a set of DOM events that will be bound to
methods on your View through Backbone.delegateEvents.
- Source:
- See:
-
Returns:
The events hash
-
Type
-
Object
initialize(options)
Creates a new QueryBuilderView
Parameters:
Name |
Type |
Description |
options |
Object
|
A literal object with options to pass to the view |
- Source:
render() → {QueryBuilder}
render - Render the view
- Source:
Returns:
Returns the view
-
Type
-
QueryBuilder
Insert two inputs: one that allows the user to edit the "exclude" attribute in
the FilterGroup model by selecting either "include" or "exclude"; and a second
that allows the user to edit the "operator" attribute in the FilterGroup model
by selecting between "all" and "any".
- Since:
- Source: