Class: Filter

Filter()

Manages all filter trees, product list and other related elements (refine by, filter mobile button,..)

Constructor

new Filter()

Creates a new filter manager. Don't manually initialize this class, it is initialized only once in BoostPFS class.
Source:

Extends

Members

children :Array

Array of child components
Type:
  • Array
Overrides:
Default Value:
  • []
Source:

data :Object

Unmodified data returned from the filter API
Type:
  • Object
Source:

filterTrees :array

Arrays of FilterTree objects
Type:
  • array
Source:

parent :Component

The parent component
Type:
  • Component
Overrides:
Default Value:
  • null
Source:

Methods

_callAllBindEvents()

Bind events on the component (include all child-components)
Overrides:
Source:

_callAllInit()

Initialize the component (include all child-components)
Overrides:
Source:

_callAllRender()

Render the component (include all child-components)
Overrides:
Source:

addComponent(childComponent)

Add the child component into a component
Parameters:
Name Type Description
childComponent Object The child component
Overrides:
Source:

afterBindEvents()

After bind evnets on the component
Overrides:
Source:

afterInit()

Send init filter request after initialize the filter component
Overrides:
Source:

afterRender()

After reder component callback
Overrides:
Source:

beforeBindEvents()

Before bind events on component callback
Overrides:
Source:

beforeInit()

Before initialize callback
Overrides:
Source:

beforeRender()

Before reder component callback
Overrides:
Source:

bindEvents()

Bind events on the component
Overrides:
Source:

init()

Initialize component
Overrides:
Source:

initFilterMobileButton()

Get DOM elements with class 'boost-pfs-filter-tree-mobile-button' and create new FilterMobileButton instances. 'data-filter-tree-id' on the element: pick which filter tree to toggle
Source:

initFilterTrees()

Get DOM elements with class 'boost-pfs-filter-tree' and create new FilterTree instances. Assigns unique ID 'boost-pfs-filter-tree1', 'boost-pfs-filter-tree2',... to the DOM elements
Source:

isBadUrl() → {boolean}

Test for XSS in URL before init filter
Source:
Returns:
Type
boolean

isBindEvents()

Returns whether or not binding the events on a component
Overrides:
Source:

isLoopThroughChild()

Returns whether or not the childs of a component is refresh
Overrides:
Source:

isRender()

Returns whether or not the component is rendered
Overrides:
Source:

modifyData(data)

Function to modify data, use for customization
Parameters:
Name Type Description
data
Source:

refresh()

Refresh component
Overrides:
Source:

removeComponent(childComponent)

Remove a child component of a component
Parameters:
Name Type Description
childComponent Object The child component
Overrides:
Source:

render()

Render compoment
Overrides:
Source:

setData(data, eventType, eventInfo)

Set the filter data returned from API, and then call this.refresh() to rebuild everything. data including: - data.filter: filter tree data (depending on the event, this might not be returned by API) - data.products: product list result data (depending on the event, this might not be returned by API)
Parameters:
Name Type Description
data Object The data returned from API
eventType string Event type that we called the API with
eventInfo Object Extra info about the event
Source: