I've added two sort components to my search page, one for Date and the other for Relevancy. How can I specify which one to use by default when my search page load?
Answer by olamothe · Apr 24, 2014 at 01:54 PM
You can specify a defaut sort option on each Tab component. If you specify your desired sort option on the default tab (that is, the first one that appears in your HTML markup), then that sort will be selected by default when your page load.
Or, you can also load your page with the parameter #sort=date%20descending, for example
Then, how to do this without url parameters? I want the page to load with a predefined sort order without having to change all the links in my site.
The url parameter is just a representation of the internal state.
You can set it programatically like this:
$('#search').coveo('init');
$('#search').coveo('state', 'sort', 'date ascending');
$('#search').coveo('executeQuery');