Prebinding Helpers List Reference
Prebinding Helpers List Reference
Legacy feature
This article pertains to the Coveo Hive framework which is now in maintenance mode. Choose one of Coveo’s more modern, lightweight, and responsive libraries for any future search interface development. See the search interface Implementation guide for more details. |
This page contains an extensive list of the prebinding methods used in the Coveo Hive framework.
fieldTranslator
Translates the given field according to the current context.
The following line:
<div data-field="@myfield" data-prebind-field="fieldTranslator"></div>
Gives the following result:
<div data-field="@fmyfield2053" data-prebind-field="fieldTranslator"></div>
analyticsEnabled
Outputs true
or false
whether the analytics are enabled or not.
The following line:
<div data-prebind-send-analytics="analyticsEnabled"></div>
Gives the following result:
<div data-send-analytics="true" data-prebind-send-analytics="analyticsEnabled"></div>
coveoForSitecoreAnalyticsEndpoint
If the value isn’t defined, assigns it a default endpoint value extracted from the context.
An existing value won’t be overridden by this prebinding method. |
The following line:
<div data-prebind-endpoint="coveoForSitecoreAnalyticsEndpoint"></div>
Gives the following result:
<div data-endpoint="mysite/coveo/rest/analytics"
data-prebind-endpoint="coveoForSitecoreAnalyticsEndpoint"></div>
currentPageName
If the value isn’t defined, assigns it the current page name value extracted from the context.
An existing value won’t be overridden by this prebinding method. |
The following line:
<div data-prebind-page-name="currentPageName"></div>
Gives the following result:
<div data-page-name="mypage" data-prebind-page-name="currentPageName"></div>
isAnonymous
Outputs true
or false
whether the user is logged in or not.
The following line:
<div data-prebind-anonymous="isAnonymous"></div>
Gives the following result:
<div data-anonymous="true" data-prebind-anonymous="isAnonymous"></div>
sortCriteria
Takes a JSON object representing a sort criteria and outputs the translated criteria.
The following line:
<div data-sort='{ "type": "field", "direction": "ascending", "field": "myfield" }'
data-prebind-sort="sortCriteria"></div>
Gives the following result:
<div data-sort='@fmyfield2053 ascending' data-prebind-sort="sortCriteria"></div>
You can add the sc-enable-both-sort-directions="true"
attribute to allow sorting in both directions.
In the Coveo for Sitecore September 18, 2020 release, the attribute has been renamed from sc-enable-direction-toggle
to sc-enable-both-sort-directions
.
You can find more details in the Usage Notes section of the Results Sorts Section article.
The following line:
<div data-sort='{ "type": "field", "direction": "ascending", "field": "myfield" }'
data-sc-enable-both-sort-directions="true"
data-prebind-sort="sortCriteria"></div>
Gives the following result:
<div data-sort='@fmyfield2053 ascending, @fmyfield2053 descending'
data-prebind-sort="sortCriteria"></div>
unfoldDictionaryToAttributes
Takes a JSON dictionary as its original value and assigns an attribute for each of them with their value.
The following line:
<div data-dictionary='{ "attribute": "value" }'
data-prebind-dictionary="unfoldDictionaryToAttributes"></div>
Gives the following result:
<div data-attribute="value" data-dictionary='{ "attribute": "value" }'
data-prebind-dictionary="unfoldDictionaryToAttributes"></div>