Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- // Initialize the variables for overrides objects
- var overrideCtx = {};
- overrideCtx.Templates = {};
- /*
- * Using the Fields override leaves the rest of the rendering intact, but
- * allows control over one or more specific fields in the existing view
- */
- overrideCtx.Templates.Fields = {
- 'Body': { 'View' : CustomField }
- };
- /*
- * Register the template overrides.
- */
- SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
- })();
- function CustomField(ctx) {
- // Really basic field-level conditional formatting
- var ret
- ret = ctx.CurrentItem.Body;
- if (ret.length > 400)
- {
- ret = ret.substring(0, 400) + ' <b><a href="/Blog/Lists/Posts/Post.aspx?ID=' + ctx.CurrentItem.ID + '">More ...</a></b>';
- }
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement