Class: ChoiceFilterView

ChoiceFilterView()

Render a view of a single ChoiceFilter model

Constructor

new ChoiceFilterView()

Source:

Extends

Members

choiceHandleClass :string

When this view is in "uiBuilder" mode, the class name for the handles on each choice row that the user can click and drag to re-order
Type:
  • string
Source:

collapseToggleClass :string

The class used for the button that toggles the collapsed state of the filter.
Type:
  • string
Since:
  • 2.25.0
Inherited From:
Default Value:
  • "collapse-toggle"
Source:

collapsed :boolean

The current state of the filter, if it is FilterView#collapsible. Whatever this value is set to at initialization, will be how the filter is initially rendered.
Type:
  • boolean
Since:
  • 2.25.0
Inherited From:
Default Value:
  • true
Source:

collapsedClass :string

The class to add to the filter when it is collapsed.
Type:
  • string
Since:
  • 2.25.0
Inherited From:
Default Value:
  • "collapsed"
Source:

collapsible :boolean

Whether the filter is collapsible. If true, the filter will have a button that toggles the collapsed state.
Type:
  • boolean
Since:
  • 2.25.0
Inherited From:
Source:

labelTemplate :Underscore.Template

The template that renders the icon and label of a filter
Type:
  • Underscore.Template
Since:
  • 2.17.0
Inherited From:
Source:

mode :string

One of "normal", "edit", or "uiBuilder". "normal" renders a regular filter used to update a search model in a DataCatalogViewWithFilters. "edit" creates a filter that cannot update a search model, but which has an "EDIT" button that opens a modal with an interface for editing the filter model's properties (e.g. fields, model type, etc.). "uiBuilder" is the view of the filter within this editing modal; it has inputs that are overlaid above the filter elements where a user can edit the placeholder text, label, etc. in a WYSIWYG fashion.
Type:
  • string
Since:
  • 2.17.0
Inherited From:
Source:

model :ChoiceFilter

A ChoiceFilter model to be rendered in this view
Type:
Overrides:
Source:

modelClass :Backbone.Model

The Filter model that this View renders. This is used to create a new instance of the model if one is not provided to the view.
Type:
  • Backbone.Model
Since:
  • 2.17.0
Overrides:
Source:

removeChoiceClass :string

The class to add to the element that a user should click to remove a choice value and label when this view is in "uiEditor" mode
Type:
  • string
Since:
  • 2.17.0
Source:

template :Underscore.Template

Reference to template for this view. HTML files are converted to Underscore.js templates
Type:
  • Underscore.Template
Overrides:
Source:

uiBuilderClass :string

The class to add to the filter when it is in "uiBuilder" mode
Type:
  • string
Since:
  • 2.17.0
Inherited From:
Source:

uiInputClass :string

The class used for input elements where the user can change UI attributes when this view is in "uiBuilder" mode. For example, the input for the placeholder text should have this class. Elements with this class also need to have a data-category attribute with the name of the model attribute they correspond to.
Type:
  • string
Since:
  • 2.17.0
Inherited From:
Source:

Methods

addEmptyChoiceEditor()

Create an empty choice editor row
Since:
  • 2.17.0
Source:

createChoiceEditor()

Create a row where a user can input a value and label for a single choice.
Since:
  • 2.17.0
Source:

createChoicesEditor()

Create the set of inputs where a use can select label-value pairs for the regular choice filter view
Since:
  • 2.17.0
Source:

events() → {Object}

A function that creates and returns the Backbone events object.
Overrides:
Source:
Returns:
Returns a Backbone events object
Type
Object

handleChange()

Updates the view when the filter input is updated
Parameters:
Type Description
Event The DOM Event that occurred on the filter view input element
Inherited From:
Source:

handleTyping()

When the user presses Enter in the input element, update the view and model
Parameters:
Type Description
Event The DOM Event that occurred on the filter view input element
Inherited From:
Source:

hideInputError(input, messageContainer)

This function hides the error message and error class added to inputs with the FilterView#showInputError function.
Parameters:
Name Type Description
input HTMLElement The input that had an error associated with its value
messageContainer HTMLElement The element in which the error message was inserted
Inherited From:
Source:

initialize(optionsopt)

Function executed whenever a new FilterView is created.
Parameters:
Name Type Attributes Description
options Object <optional>
A literal object of options to set on this View
Inherited From:
Source:

previewRemoveChoice()

Indicate to the user that the choice value and label inputs will be removed when they hover over the remove button.
Since:
  • 2.17.0
Source:

removeChoice(e)

Remove a choice editor row and the corresponding label-value pair from the choice Filter Model (TODO)
Parameters:
Name Type Description
e Object The click event object
Since:
  • 2.17.0
Source:

render(templateVars)

Render an instance of a Filter View. All of the extended Filter Views also call this render function.
Parameters:
Name Type Description
templateVars Object The variables to use in the HTML template. If not provided, defaults to the model in JSON
Overrides:
Source:

showInputError(input, messageContainer, message)

This function indicates that there is an error with an input in this filter. It displays an error message and adds the error CSS class to the problematic input.
Parameters:
Name Type Description
input HTMLElement The input that has an error associated with its value
messageContainer HTMLElement The element in which to insert the error message
message string The error message to show
Inherited From:
Source:

showValidationErrors(errors)

Show validation errors. This is used for filters that are in "UIBuilder" mode.
Parameters:
Name Type Description
errors Object The error messages associated with each attribute that has an error, passed from the Filter model validation function.
Overrides:
Source:

toggleCollapse(collapseopt)

Toggle the collapsed state of the filter. If collapse is a boolean, then set the collapsed state to that value. Otherwise, set it to the opposite of whichever state is currently set.
Parameters:
Name Type Attributes Description
collapse boolean <optional>
Whether to collapse the filter. If not provided, the filter will be collapsed if it is currently expanded, and vice versa.
Since:
  • 2.25.0
Inherited From:
Source:

updateChoices()

Update the choices in the select dropdown menu based on which choices are currently selected
Source:

updateModel()

Updates the value set on the ChoiceFilter Model associated with this view. The filter value is grabbed from the select element in this view.
Overrides:
Source:

updateModelChoices()

Update the choices attribute in the choiceFilter model based on the values in the choices editor
Since:
  • 2.17.0
Source:

updateUIAttribute(e)

Updates the corresponding model attribute when an input for one of the UI options changes (in "uiBuilder" mode).
Parameters:
Name Type Description
e Object The change event
Since:
  • 2.17.0
Inherited From:
Source: