lundi 26 janvier 2015

js link group list items SharePoint 2013




(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 :







0 commentaires:

Enregistrer un commentaire