vLookup Multiline Text Column with "read more"
- This topic has 2 replies, 2 voices, and was last updated 7 years, 1 month ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Home › Forums › vLooup for SharePoint › vLookup Multiline Text Column with "read more"
Hi Alexander,
Is it possible to limit a multiline text column to – for example – 2 lines and have a “read more” link after the 2 lines to show the full text like in an accordion ?
Thank you very much in advance.
BR,
Chris
Add this you the Special configuration textarea for the multiline text field in the vLookup config (in the ViewFields section):
{"function":"readMore"}
Then add this to your Custom JS (in all forms and also in the list view if you use vLookup in a list view):
function readMore(val, item) {
var v = val;
if (val.length > 100) {
var trunc = val.substring(0, 100);
v = "<span style='cursor:pointer;' onclick='jQuery(this).hide().next().show()'>" + trunc + "...</span><span style='display:none;'>" + val + "</span>";
}
return v;
}
Please note that this will only work for a plain text multiline and not rich text (because the substring will break the HTML of the field value).
Alexander
Hi Alexander,
Thank you very much this worked like a charm.
BR,
Chris