0

Is there any way to display column count in Quick Edit mode? Datasheet view had this option to "Show Totals" but this seems to be missing with Quick Edit

2
  • Quick edit mode? Are you referring to List Views? Commented Jul 19, 2017 at 13:43
  • @ThinkB4Code Yes,the alternative of Datasheet view in SPO
    – George
    Commented Jul 19, 2017 at 13:49

1 Answer 1

2

To get the item count of list, just send a REST query to list ItemCount endpoint. It will provide you with the count of items in list. After that you can place the data where ever you like in the page.

Following is the code to achieve the same:

<script
    src="https://code.jquery.com/jquery-3.2.1.min.js"
    integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
    crossorigin="anonymous"></script>
<script>
    function getListItemCount(listTitle){
        var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listTitle + "')/ItemCount"
        $.getJSON(url, function(data){
            $(".ms-csrlistview-controldiv").append("<div>Item Count: " + data.value + "<div>")
        })
    }

    $(document).ready(function(){
        getListItemCount('TestList');
    })
</script>

Output:

enter image description here

Just place the code in a script editor web part and you are good to go.

5
  • Will this work on the quick edit mode / datasheet view? Commented Jul 19, 2017 at 16:18
  • Yes this will work. The AJAX call is to get the Item Count. You can place it anywhere in the UI. Since I used modified OOTB list view all item, i picked $(".ms-csrlistview-controldiv") selector to place the data. You need to change the selector as per your requirement. Commented Jul 20, 2017 at 5:01
  • This works.I really wonder why this OOB feature was removed with Quick Edit. :( What does the value of integrity and crossorigin mean in the script?
    – George
    Commented Jul 20, 2017 at 10:27
  • Both are the attribute used when you are referring styles/scripts from CDN. Refer to this URL to learn more. developer.mozilla.org/en-US/docs/Web/Security/… Commented Jul 20, 2017 at 10:34
  • This solution does not update the count if we filter on a column
    – George
    Commented Jan 25, 2018 at 13:14

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.