BoxBody component (Deprecated)
BoxBody component (Deprecated)
|
|
Deprecated
This feature is still available, but no longer supported as of the August 2023 release of Coveo for Salesforce version 5.2. |
This component appends a ResultList component and ensures the correct CSS styles are applied so infinite scrolling works correctly.
By default, the ResultList component is initialized with the following option:
enableInfiniteScroll: true;
To modify other options on the ResultList component, initialize the framework as follows:
$('#MyBox').coveo('initBox', {
BoxBody : {
infiniteScrollPageSize : 20
}
})
Options
enableInfiniteScroll
Specifies whether the component should automatically load more results when the user has reached the bottom of the result list.
The default value is true.
<div class="CoveoBoxBody" data-enable-infinite-scroll="true"></div>
resultTemplate
|
|
Note
If you created your Box component using the Interface Editor and the HTML template editor that’s provided with that product, then you will most likely not have to handle the templates manually. The following documentation is provided only if you manually created the markup of your page. This is not relevant for you if you’re using the Interface Editor. |
This option specifies a result template that the body should use.
There are many ways to specify a result template:
-
Put a
scripttag with the classresult-templateand the correct mime-type as a child of the component in yourHTMLmarkup.Example<div class="CoveoBoxBody"> <script class='result-template' type="text/x-underscore-template"> <%= clickUri %> </script> </div> -
Assign the result template to the
BoxBodyComponent itself when you initialize the framework.ExampleAssuming you have a
scripttag with the idMyBoxTemplate, your tag should look like this:$('#MyBox').coveo('initBox', { BoxBody : { resultTemplate : new Coveo.Ui.UnderscoreTemplate($('#MyBoxTemplate').get(0)) } }); [...] <script id="MyBoxTemplate" type="text/x-underscore-template"> <%= clickUri %> </script>
|
|
Note
You can read more about result templates and result template helpers. |
Methods
getHeight
Returns the height of the component.
It’s used mostly for the resize method.
$('#myBoxBody').coveo('getHeight')
resize
Calculates the current required height for the body so that infinite scrolling works correctly.
It’s called once when the component is first initialized and after every query, but you might need to call it again if you have something in your box that changes the header or footer height.
$('#myBoxBody').coveo('resize')
Usage
<div class='CoveoBoxBody'></div>