1

In Sharepoint allitems.aspx page it shows 30 on the page – is it possible to have it say the number of pages or number of total files (e.g 1-30 of 67 or page 1 of 3) like that using css or jquery? enter image description here

1

Add the following code into a script editor web part into list view page.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" type="text/javascript"></script>
<script type="text/javascript">
SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function() {
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
      OnPostRender: function(ctx) {
        var listId = _spPageContextInfo.pageListId.replace("{","").replace("}","");
        var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists(guid'"+listId+"')/ItemCount";
        $.ajax({
            url: url,
            method: "GET",
            headers: { "Accept": "application/json; odata=verbose" },
            success: function (data) {       
                 var itemCount=data.d.ItemCount;
                 var totaltext = $(".ms-paging").text() + " of " + itemCount;
                 $(".ms-paging").text(totaltext);
            },
            error: function (error) {
                console.log(JSON.stringify(error));
            }
        });
      }
    });
 });
 </script> 

enter image description here

1

Just add the below script in script editor webpart for that particular list view or add it in master page to change it for all the list views.

/// <reference name="MicrosoftAjax.js"/>
/// <reference path="C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\SP.js"/>
/// <reference path="C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\SP.Core.js"/>
/// <reference path="C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\core.js"/>
/// <reference path="C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\SP.debug.js"/>
/// <reference path="C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\SP.UI.debug.js"/>
/// <reference path="C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\SP.UI.Core.debug.js"/>
/// <reference path="C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\SP.UI.Dialog.debug.js"/>
/// <reference path="jquery-1.6.4.min.js" />

$(document).ready(function () {

    ExecuteOrDelayUntilScriptLoaded(ready, "sp.js");

    function ready() {

        var listID = SP.ListOperation.Selection.getSelectedList();

        if (listID != null) {
            var context = new SP.ClientContext.get_current();

            var web = context.get_site().get_rootWeb();

            var list = web.get_lists().getById(listID);

            context.load(list);

            context.executeQueryAsync(function (sender, args) {

                var count = list.get_itemCount();

                var totaltext = $(".ms-paging").text() + " of " + count.toString();

                $(".ms-paging").text(totaltext);

            }, function (sender, args) { });
        }
    }
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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