Constructor
new FilterOptionItemBox()
Extends
Members
children :Array
Array of child components
Type:
- Array
- Inherited From:
- Default Value:
- []
- Source:
parent :Component
The parent component
Type:
- Component
- Inherited From:
- Default Value:
- null
- Source:
requestInstantly :boolean
If set to 'true', when clicked, it will call the API right away.
If set to 'false', when clicked, it will set 'this.selected = true', and not call API.
Use this together with the apply button to check for selected items and then call API.
Type:
- boolean
- Inherited From:
- 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
- Overrides:
- Source:
buildCount() → {string}
Build the product count text of the filter value
- Inherited From:
- Source:
Returns:
- The count text
- Type
- string
buildLabel() → {string}
Format the filter item label: remove prefix, captialize,...
- Inherited From:
- Source:
Returns:
- Type
- string
buildPercentSaleLabel() → {string}
Build special label for percent sale:
'Under X%', 'Above Y%',...
- Inherited From:
- Source:
Returns:
- Type
- string
init()
Initialize component
- Inherited From:
- Source:
isAppliedFilter() → {boolean}
Check if the filter item is applied (already called API)
A filter item might be selected (visually) but we haven't applied it (call API) yet.
- Inherited From:
- Source:
Returns:
- Type
- boolean
isBindEvents()
Returns whether or not binding the events on a component
- Inherited From:
- Source:
isDisabled() → {boolean}
Check if the filter item is show but greyed out (disabled)
Item is disabled when they have 0 products
- Inherited From:
- Source:
Returns:
- Type
- boolean
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:
onApplyFilter()
Perform API request
- Inherited From:
- Source:
onClick()
On click the filter option item.
This checks for 'this.requestInstantly' field to see if we call API right away or just set 'this.selected=true'
- Inherited From:
- Source:
onSelectFilter()
Select the filter item but don't perform API request yet.
- Inherited From:
- Source:
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:
setBoxItemSize()
Set the css 'width' value of each box.
This is called in 'bindEvents', after its element is rendered on the DOM
setData(data)
Set data for filter option items
This also calls buildLabel(), buildCount(), and set isAppliedFilter()
Parameters:
Name | Type | Description |
---|---|---|
data |
Object | One element of the array: data.filter.options[index].values from API. |
- Inherited From:
- Source: