Events and custom methods for Advanced widgets

Registering event handlers and methods for Advanced widgets

You can override some behaviour of the widget with your own methods or get notified of certain events.
Those overrides works on the same way as defining options

The next options can be added to the script:


engineid: '-insert-your-engine-id',
renderPagination: function (page, totalRecords, itemsPerPage)
/* insert your code here */

The following methods have been provided as an override:


Show / hide loader

Use those events to make your own loading animation to inform visitors the input is being handled.


showLoader: function () { /* insert your code */ },
hideLoader: function () { /* insert your code */ },


Get selected facets

If you have implemented your own way of handling facets then its needed to override this method to your needs


getSelectedFacets: function () { 
insert your code here :
return array with ids like var selectedFacets = [];


Event notifications

Get notified when the widget will start rendering the search results.

beforeRenderResponse: function (data, initial) { },

Get notified when the widget is ready with rendering the search results.

afterRenderResponse: function (data, initial) { },

Notifies before search operation begins.

beforeSearch: function(term){},

Notifies after search operation has ended.

afterSearch: function(term){},

Notifies after search operation has ended but not on every typed character. 

afterSearchDebounced: function(term){},

Rendering HTML without using template engine

If you have your own template engine in place or you want to disable certain methods you need to override these methods

renderPagination: function (page, totalRecords, itemsPerPage) { },
renderResultItem: function (item) { },
renderFacetGroup: function (facetGroup) { },
addActiveFacetGroupItems: function (facetGroup) { },
renderResultHeader: function(data) {}

Or override the following method to fully intercept the rendering process

renderResponse: function (data, initial) { },