Skip to content

Grid View, List View and No Result View

Simon edited this page Jul 27, 2016 · 1 revision

The type of view to display is defined by the property page defined in lib/transform/search-results-to-templage-data.

page: results.data.length ? queryParams.pageType : 'noresults'

So the property page is equal to the value store in queryParams.pageType if there is at least one result otherwise it is equal to "noresults".

The value of queryParams.pageType is defined in lib/query-params/query-params.js

result.pageType = queryParams.query['page[type]'] || 'search'

By default the value is equal to "search" and it is equal to the value of the query parameter page[type] if defined in the url. Joi validate the type of this query parameter (must be a string and only "search" and "results-list" are right values)

The partial templages/partials/search/result-page.html check the value of the page type and display the right partial.

Clone this wiki locally