SharePoint 2013 Pagination Options Google/Bing/etc

Google, Bing pagination on SharePoint search result page only two step away. 

OOB Pagination Control options 

  1. Start Position
  2. When user click to the “2” page to the previous and next button will appear
  3. The total number of page will display on pagination control at a time is 6.
  4. So the page number 1 is not visible


1) Export Search Results Web Part:

Number of pages in pagination UI is controlled by two variables in the Search Results web part:

<property name="MaxPagesBeforeCurrent" type="int">7</property>
<property name="MaxPagesAfterCurrent" type="int">7</property>


You will now get this:




To get the UI to always go back to Page 1:

2) Source code added to Search Display Template Control_SearchResults.html starting on about line 399.



<!--#_
//max before current page - ctx.ClientControl.$1K_4
//current page - ctx.ClientControl.$14_4
// if page 1 no longer shows in the pagination UI,
// create a link to page 1
if(ctx.ClientControl.$14_4 > ctx.ClientControl.$1K_4 + 1)
{
var pageLinkId = "PageLink_1";
var pageLinkTitle = "Move to first page";
var pageStart = "1";
_#-->

<li id="PagingLink"><a id="_#= $htmlEncode(pageLinkId) =#_" href="#" title="_#= $htmlEncode(pageLinkTitle) =#_" onclick="$getClientControl(this).page(_#= $htmlEncode(pageStart) =#_);return Srch.U.cancelEvent(event);">_#= $htmlEncode(pageStart) =#_</a></li>
<!--#_

}
_#-->





Comments

Popular posts from this blog

SharePoint RPC Protocols Examples Using OWSSVR.DLL

Send Email using SharePoint Rest API

Query suggestions in SP 2013 Using Rest API (/_api/search/suggest)