Constructor
new FilterOptionBox()
Extends
Members
children :Array
Array of child components
Type:
- Array
- Inherited From:
- Default Value:
- []
- Source:
filterItems :Map.<String, FilterOptionItem>
A Map of filter option items
id: filter item key
value: FilterOptionItem instance
Type:
- Map.<String, FilterOptionItem>
- Inherited From:
- Source:
parent :Component
The parent component
Type:
- Component
- Inherited From:
- Default Value:
- null
- Source:
Methods
_callAllBindEvents()
Bind events on the component (include all child-components)
- Inherited From:
- Source:
_callAllInit()
Initialize the component (include all child-components)
- Inherited From:
- Source:
_callAllRender()
Render the component (include all child-components)
- Inherited From:
- Source:
addComponent(childComponent)
Add the child component into a component
Parameters:
Name | Type | Description |
---|---|---|
childComponent |
Object | The child component |
- Inherited From:
- Source:
afterBindEvents()
After bind evnets on the component
- Inherited From:
- Source:
afterInit()
After initialize callback
- Inherited From:
- Source:
afterRender()
After reder component callback
- Inherited From:
- Source:
beforeBindEvents()
Before bind events on component callback
- Inherited From:
- Source:
beforeInit()
Before initialize callback
- Inherited From:
- Source:
beforeRender()
Before reder component callback
- Inherited From:
- Source:
bindEvents()
Bind events on the component
- Inherited From:
- Source:
calculateBoxItemSize() → {string}
Calculate the css 'width' of each box element
Returns:
- Type
- string
getBlockContentTemplate() → {string}
Get the content html template for DisplayType.BOX
- Overrides:
- Source:
Returns:
Raw html template
- Type
- string
getNumberAppliedFilterItems() → {Number}
Get the number of applied filter items
in this filter option.
- Inherited From:
- Source:
Returns:
number of applied filter items
- Type
- Number
getTemplate() → {string}
Get the filter option template.
Depending on its filterTreeType, it returns different templates for 'vertical' and 'horizontal'
- Inherited From:
- Source:
Returns:
Raw html template for a single filter option
- Type
- string
init()
Initialize component
- Inherited From:
- Source:
isBindEvents()
Returns whether or not binding the events on a component
- Inherited From:
- Source:
isLoopThroughChild()
Returns whether or not the childs of a component is refresh
- Inherited From:
- Source:
isRender()
Returns whether or not the component is rendered
- Inherited From:
- Source:
isSortValues() → {boolean}
Check if we need to sort filter option values
- Inherited From:
- Source:
Returns:
- Whether we need to sort values or not.
- Type
- boolean
markValuesAsNoRender(values)
Mark values in the array as no render.
If we have more than scrollFirstLoadLength filter values,
and showMoreType=='scrollbar',
don't render all values at once, but append them on scroll.
Parameters:
Name | Type | Description |
---|---|---|
values |
Array | The data.values array. |
- Inherited From:
- Source:
modifyValues(values)
Modify the value list.
For example: add collection All to the list.
It modifies the values array in-place.
Parameters:
Name | Type | Description |
---|---|---|
values |
Array | The data.values array. |
- Inherited From:
- Source:
naturalSortFunction(a, b) → {number}
Function to sort naturally (mixed number and text)
Sort number from small to big, and then sort text alphabetically.
For text mixed with number, if the text starts with a number, sort the number part first.
Ex: 0, 1, 1b, 2, 2a, 2b, ab, ba
Parameters:
Name | Type | Description |
---|---|---|
a |
||
b |
- Inherited From:
- Source:
Returns:
- Type
- number
refresh()
Refresh component
- Inherited From:
- Source:
removeComponent(childComponent)
Remove a child component of a component
Parameters:
Name | Type | Description |
---|---|---|
childComponent |
Object | The child component |
- Inherited From:
- Source:
render()
Render compoment
- Inherited From:
- Source:
setData(data)
Set data for filter option.
This will also call the sort function for filter values.
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | One element of the array: data.filter.options from API. |
- Inherited From:
- Source:
sortValues(values)
Sort the values.
This is called if isSortValues() returns true.
It modifies the values array in-place.
Parameters:
Name | Type | Description |
---|---|---|
values |
Array | The data.values array. |
- Inherited From:
- Source: