Apr 01, 2023
SearchResults Component
On this page
usf.components.SearchResults
component class uses usf.templates.searchResults
template to render the search results.
Properties
Name | Data type | Description |
---|---|---|
term read-only |
String | "red fox" The search term. |
sortBy read-only |
String | "price" , "-price" , etc.The sort order of the view. |
view read-only |
String | "list" or "grid" The layout mode of the view. |
facetFilters read-only |
Object | The facet filters object. |
page | Number | The current page number. |
itemsPerPage | Number | The number of items per page. |
take | Number | The number of items to show. |
pagesTotal read-only |
Number | The total number of pages. |
noFacets read-only |
Boolean | true if the returned results have no facet filters; otherwise false . |
hasFacets | Boolean | true if the results have facets. |
hasResults read-only |
Boolean | true if the returned data has product results. |
loader | Boolean | true if it's fetching data from the indexing server; otherwise false . |
facetFilters | Object | The facet filters retrieved from the query object. |
result | Object | The search result retrieved from our server. |
Methods
Name | Description |
---|---|
onInfiniteLoad | This event handler is invoked when a user clicks on a grid view or a list view item. |
onItemHover | This event handler is invoked when a user hovers mouse over a grid view or a list view item. |
onItemLeave | This event handler is invoked when the mouse leaves a grid view or a list view item. |
onRedirect | onRedirect(targetUrl) This event handler is invoked when the search term triggers a page redirect to the specified targetUrl . |
onSortByChanged | onSortByChanged(sortValue) This event handler is invoked when the user changes the sort order specified in the sortValue input parameter. If sortValue is null or empty, the sort order is reset to the default value |
clearSearch | clearSearch() Clears the search input. |
onGridViewClick | onGridViewClick() Invoked when user clicks on the Grid view icon. |
onListViewClick | onListViewClick() Invoked when user clicks on the List view icon. |
onLoadMore | onLoadMore() Invoked when user clicks on the 'Load more' button or scrolls down to the bottom if the Pagination mode is set to Infinite scroll. |
refresh | refresh(dontReset) Refreshes the current view. If dontReset is true , the widget wont clear all the search parameters in the URL. |