Sunday, August 31, 2014

CSR for Group

HI, colleagues!


I have a code CSR



overrideCtx.Templates.Group = CustomGroup;
overrideCtx.Templates.Item = customItem;

and


function CustomGroup(ctx, group, groupId, listItem, listSchema, level, expand) {

//var html = '<ul id="list1">' + listItem[group] + '</ul>';
html = '<ul id="list1">' + listItem[group] + listItem;
html += '</ul>';

return html;

}


function customItem(ctx) {
var ret = "<li><div>" + ctx.CurrentItem.Title + "</div></li>";
return ret;

}



but it generates separate blocks


<ul id="list1">123</ul>
<li>
<div>123</div>
</li>
<li>
<div>123</div>
</li>

how to make the blocks were elements within the block groups like this


<ul id="list1">123
<li>
<div>123</div>
</li>
<li>
<div>123</div>
</li>
</ul>


No comments:

Post a Comment