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

  • Quick edit mode? Are you referring to List Views? – ThinkB4Code Jul 19 '17 at 13:43
  • @ThinkB4Code Yes,the alternative of Datasheet view in SPO – George Jul 19 '17 at 13:49
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.

  • Will this work on the quick edit mode / datasheet view? – SharePointer Jul 19 '17 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. – ThinkB4Code Jul 20 '17 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 Jul 20 '17 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/… – ThinkB4Code Jul 20 '17 at 10:34
  • This solution does not update the count if we filter on a column – George Jan 25 '18 at 13:14

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.