Categories Breadcrumb

Overview

This component shows breadcrumbs of the selected category.

To update the categories components, you can link the sidebar to the categories component. This will either update this component when a category is clicked in the categories component, or update the categories component when this component is clicked.

Usage

How to create this component.

var categoriesBreadcrumb = sdk.component('categoriesBreadcrumb', target:String, options:Object);

Sample

By default, this component looks like this:

Target

This is the HTML component. For example, the "#inbenta" target is:

<div id="inbenta"></div>

Options

Available options to set in this component

Name Type Default Description
categoryId integer 0 Active category
loadCategoryOnClick boolean true When a category is clicked load it in the component

Default options object

{
  categoryId: 0
}

Methods

Methods can be used in this component.

Name Description
setActiveCategory(category: integer) Set the active category
setCategoriesDataInterceptor(interceptor:function) Set a categories interceptor.

Example

Set setActiveCategory 1 to the categoriesBreadcrumb component.

// Load at the begining
var categoriesBreadcrumb = sdk.component('categoriesBreadcrumb', '#categoriesBreadcrumb', {categoryId:1});

// or after ready
categoriesBreadcrumb.untilReady.then(function(){
  categoriesBreadcrumb.setActiveCategory(1);
});

Subcomponents

This component does not have any subcomponents.

Events

Events to listen on this component.

Name Event data Description
click category Sent whether a category is clicked

Tracking

This component does not track any data.

Labels

Labels of this component. The default labels of each component can be rewritten in the SDK creation configuration.

Name Default Description
CATEGORIES_BREADCRUMB_HOME Home HTML for back first level

Examples

Do something when event 'categoryId' is emitted.

var categoriesBreadcrumb = sdk.component('categoriesBreadcrumb', '#categoriesBreadcrumb');
categoriesBreadcrumb.$on('categoryId', function (categoryId) {
  // Do something awesome
});