Skip to content

Instantly share code, notes, and snippets.

@IAMIronmanSam
Last active January 17, 2017 02:32
Show Gist options
  • Save IAMIronmanSam/fe9acb040a62fd0ef04863902f72db70 to your computer and use it in GitHub Desktop.
Save IAMIronmanSam/fe9acb040a62fd0ef04863902f72db70 to your computer and use it in GitHub Desktop.
Simple JSLink Template
/*
Add clienttemplates.js reference in master page
<script type="text/javascript">RegisterSod("clienttemplates.js", "/_layouts/15/clienttemplates.js");</script>
*/
(function () {
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Header: "<div class='col-md-12'>",
Body: function (ctx) {
for(var v in ctx.ListData.Row){
var CurrentItem = ctx.ListData.Row[v];
var _announcementTitle = CurrentItem.Title;
var _announcementDesc = CurrentItem.Banner_x0020_Description;
var _announcementID = CurrentItem.ID;
var _profilePic = CurrentItem.Banner_x0020_Image;
return "<img src='"+ _profilePic +"' alt='profile'/><p><b>" + _announcementTitle + "</b></p>" + _announcementDesc +"<a href='/Lists/Company%20Announcements/DispForm.aspx?ID="+ _announcementID +"'> Read More...</a></td></tr>";
}
},
Footer : "</div>"
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment