In reference to your article: http://jsuhail.blogspot.com/2014/09/client-side-rendering-using-jslink-post.html
I`m after adding eclipse for text more than 250 characters, so on the webpart it shows only text upto 250 characters and for rest it shows an eclipse (...)
I have tried the following code and seems something gone missing, please assist.
Code:
(function () {
// Create object that have the context information about the field that we want to change it's output render var bodyFieldContext = {}; bodyFieldContext.Templates = {}; bodyFieldContext.Templates.Fields = { // Apply the new rendering for Priority field on List View
// update by Jason: name of the field: msg and view name : AllItems (List name: msgtext) "msg": { "AllItems": bodyFieldTemplate } };
Hi Suhail,
ReplyDeleteIn reference to your article: http://jsuhail.blogspot.com/2014/09/client-side-rendering-using-jslink-post.html
I`m after adding eclipse for text more than 250 characters, so on the webpart it shows only text upto 250 characters and for rest it shows an eclipse (...)
I have tried the following code and seems something gone missing, please assist.
Code:
(function () {
// Create object that have the context information about the field that we want to change it's output render
var bodyFieldContext = {};
bodyFieldContext.Templates = {};
bodyFieldContext.Templates.Fields = {
// Apply the new rendering for Priority field on List View
// update by Jason: name of the field: msg and view name : AllItems (List name: msgtext)
"msg": { "AllItems": bodyFieldTemplate }
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(bodyFieldContext);
})();
// This function provides the rendering logic for list view
function bodyFieldTemplate(ctx) {
var body = ctx.CurrentItem[ctx.CurrentFieldSchema.body];
var bodyHTML="";
if (body.toString().length > 250) {
bodyHTML = body.toString().substring(0,250) + "...";
}
return bodyHTML;
}