Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Js link - Display group count list SharePoint 2013

$
0
0
 

I have a list column name "category" with values like Completed, Not Completed, Started.

I want to group list items based on category.  I want to format it without showing all the list items so that it should look like:

    Completed : 45
    Not Completed : 30
    Started : 20

I am using Js link functionality on the list webpart to achieve it.

  (function () {

    var itemCtx = {};
    itemCtx.Templates = {};
    itemCtx.Templates.Group = GroupOverride;
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(itemCtx);
    })();
    function GroupOverride(Ctx, group, groupId, listItem, listSchema, level, expand) {

    return '<div style="font-weight:bold; display: inline-block;">' + listItem[group] + ' ::'  + '<div><ul>'+ listItem[group].Count + '</ul></div>' + '</div>';

    }



By using above code, I am able to show category names but not the count (listItem[group].Count is throwing error). Any idea how to achieve it?

    Completed : 
    Not Completed :
    Started : 

             

Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>