I've hit a wall on figuring out how to remedy this issue. Im currently developing a search center page with jQuery datatables and control and item display templates. The search results webpart is configured to use a result source, and when configuring the result source, the test query returns all docs in the library. I have the max setting of 50 set to the number of items per page that should be returned. I know the issue stems from the control template, as when i removed it, it returned all of the documents, when i set it back to use the control template, it only returned 50 docs. below is the code from the control template

`<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">  
    <title>Tax Template Datatable Control</title> 

    <!--[if gte mso 9]><xml> 
        <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden> 
        <mso:MasterPageDescription msdt:dt="string">Display a Accordion Control</mso:MasterPageDescription> 
        <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106601</mso:ContentTypeId> 
        <mso:TargetControlType msdt:dt="string">;#SearchResults;#Content Web Parts;#</mso:TargetControlType> 
        <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated> 
        <mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded> 
        <mso:CrawlerXSLFile msdt:dt="string"></mso:CrawlerXSLFile> 
        <mso:HtmlDesignPreviewUrl msdt:dt="string"></mso:HtmlDesignPreviewUrl> 
        <mso:HtmlDesignStatusAndPreview msdt:dt="string">https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, Conversion successful.</mso:HtmlDesignStatusAndPreview>


        if (!$isNull(ctx.ClientControl) && !$isNull(ctx.ClientControl.shouldRenderControl) && !ctx.ClientControl.shouldRenderControl()){return "";} 
        ctx.ListDataJSONGroupsKey = "ResultTables"; 
        ctx["CurrentItems"] = ctx.ListData.ResultTables[0].ResultRows; 
        AddPostRenderCallback(ctx, function() {


Document Name
Last Modified Time

    <div id="Groups" class="ms-srch-result-groups"> _#= ctx.RenderGroups(ctx) =#_</div>


Is there some limitation that datatables have when using a sharepoint search results webpart?

PS: the code snippet feature on this site cut off the end of the code, which is just some plain ole HTML

1 Answer 1


Solved this by using an unsupported workaround. Just insert the code below into a Script editor (key in script tags too) and edit the newMaxItems variable to a size that is appropriate. Note: if you insert larger sizes in the newMaxItems variable, it will affect performance. `

var CC = window.CC || {};
CC.CORE = CC.CORE || {};

CC.CORE.IncreaseSearchResultsMax = (function () {
    "use strict";

    var $ocreate = null;
    var newMaxItems = 100;
    var oldMaxItems = 50; // web part must be set to show this many items

    // on application initialization 
    // steal the global create variable and 
    // intercept calls to create UI widgets.
    Sys.Application.add_init(function() {
        $ocreate = $create;
        $create = updateResultCountCreate;

    // listen to UI widget calls for CBS & DP
    var updateResultCountCreate = function (a,b){
        var ps = Array.prototype.slice.call(arguments, 0);  
        if(a === Srch.ContentBySearch && b.numberOfItems === oldMaxItems) { 
            b.numberOfItems = newMaxItems;
        if(a === Srch.DataProvider && b.resultsPerPage === oldMaxItems) {
            b.resultsPerPage = newMaxItems;
        $ocreate.apply(this,ps);  // apply the original $create method that we stole
    return true;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.