質問

(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>';    
}

I have a list column name "category" and have 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

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

Completed : 
Not Completed :
Started : 
役に立ちましたか?

解決

You can find the count using

function GroupOverride(Ctx, group, groupId, listItem, listSchema, level, expand) {
    var html  = '<div style="font-weight:bold; display: inline-block;">';
        html += listItem[group] + ' :: <div>';
        html += '<ul>'+ listItem[group + ".COUNT.group"] + '</ul></div></div>';

    return html;
}
ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top