Abstract class for filter type classes to extend.
- It is recommended to override the methods in the 'actions' code region, rather than those in the 'controls' region, to avoid having to manually trigger the class events.
Metadata for column this filter is attached to - pulled from objects in JSONMetaTable.metadata
.
Options for instance of filter. Merged with defaults:
{
containerClass: 'json-meta-table-filter',
buttonClass: 'json-meta-table-filter-button',
inputContainerClass: 'json-meta-table-filter-input',
inputHasValueClass: 'json-meta-table-filter-has-value',
emptyOptionText: 'Select one',
trueOptionText: 'True',
falseOptionText: 'False',
placeholderText: 'Search',
typingUpdateDelay: 500
}
containerClass
: Class added to filter container elementbuttonClass
: Class added to<button>
elementinputContainerClass
: Class added to the<input>
container elementinputHasValueClass
: Class added to the container element when the filter has a value setemptyOptionText
: Text for empty option text for filters using the<select>
elementtrueOptionText
: Text forCheckboxFilter
filter typetrue
optionfalseOptionText
: Text forCheckboxFilter
filter typefalse
optionplaceholderText
: Text to use for<input>
placeholder
attributetypingUpdateDelay
: Time in milliseconds to delay updating the filter value when typing
Public control methods to be accessed on an instance are as follows:
Initialise filter instance - executes render
and bind
methods.
Render filter instance - used to apply classes and structure HTML.
Toggle visibility between input and button display, based on provided isVisible
parameter.
If true
, input is visible, else button will be visible.
Set new filter value and toggle options.inputHasValueClass
class on container element if a value is set.
This class triggers the following events:
Triggered before filter instance initialisation.
Triggered after filter instance initialisation.
Triggered before filter has rendered.
Triggered after filter has rendered.
Triggered before input/button visibility is toggled.
{
isVisible: isVisible // Visibility: true if input is to be visible, false if button
}
Triggered after input/button visibility is toggled.
{
isVisible: isVisible // Visibility: true if input is visible, false if button
}
Triggered before new filter value is set.
{
newValue: value // New value to be set
}
Triggered after new filter value is set.
{
value: value // Value that was set
}