Class: MultipleFilterOptions

Filters. MultipleFilterOptions


new MultipleFilterOptions()

MultipleFilterOptions Component
A component for building filters with multiple options.
The user is not bound to a single selection, so the filters are sent as "ors"

Properties:
Name Type Argument Description
options object

The selectable options.

actionMethod function <optional>

A function that is called when an option is toggled

Source:
See:
Example
// Like options will be nested under a single Header:
// ______________
// |Age:         |
// | [] 10-19... |
// |             |
// | Registered  |
// | [] Yes ...  |
// |_____________|

filterOptions: {
	'Age': {
		'10-19': {'label': '10-19'},
		'20-29': {'label': '20-29'},
		'30-39': {'label': '30-39'}
	},
	'Registered': {
		'Yes': {'is_registered': true},
		'No' : {'is_registered': false}
	}
},
render: function() { return(
	<Br.Filter filters={this.filterOptions} actionMethod={this.requestNewData} multiple={true} />
)}

Methods


<static> buildOptionGroups()

Builds the JSX for each option group.
Each group is built into an array, and then rendered under a single Form
with a unique formKey for just this component.

Source:
Returns:
Type
null

<static> buildOptions(header)

Builds the JSX for each checkbox in the filter.

Parameters:
Name Type Description
header obj

The header label for the checkbox

Source:
Returns:
Type
JSX

<static> componentDidMount()

Called anytime the component mounts.
Generates a unique formKey for the checkboxes's form and saves it to state.
Also attached a change listener to the FormStore to get updates when changes are made.

Source:
Returns:
Type
null

<static> componentWillUnmount()

Called when the component is unmounted.
Removes the FormStore listener.

Source:
Returns:
Type
null

<static> getInitialState()

Gets the initial state of the component

Source:
Returns:
Type
obj

<static> handleChange(forKey, filters)

Use the filter object to request the resource again

Parameters:
Name Type Description
forKey string

The form key for the filters form

filters obj

The filters we're passing to be requested

Source:
Returns:

null


<static> render()

Renders the MultipleFilterOptions component

Source:
Returns:
Type
JSX

<static> setFilters()

Builds a filter object that can span multiple attributes and multiple queries
Then requests the resource again using the new filter.

Source:
Returns:

null

Example
// Output
{
    filter1: '[query, query, query]',
    filter2: '[query, query, query]',  // Give me everything that meets any query in all filters.
    filter3: '[query, query, query]',  // in other words give me anything with, filter1 (x or y) AND filter 2 (a or b)
}