vLookup Multiline Text Column with "read more"

Forums vLooup for SharePoint vLookup Multiline Text Column with "read more"

This topic contains 2 replies, has 2 voices, and was last updated by  Christopher Holubarz 4 weeks ago.

  • Author
    Posts
  • #27108

    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

  • #27112

    Alexander Bautz
    Keymaster

    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

  • #27150

    Hi Alexander,

    Thank you very much this worked like a charm.

    BR,
    Chris

You must be logged in to reply to this topic.