locked
Limit display of Multiple Lines of Text Column in List and/or Webpart RRS feed

  • Question

  • MOSS 2007.  I've got a list that includes a column we'll call Notes.  Each list item ends up with a pretty decent paragraph here.  The list contains a lot of other columns, too.  So when you view the list, each entry has a tall, thin bunch of text from this column that pushes each entry to about half a screen.

    Is there any way to easily remedy this without eliminating the Notes column from the view?  Can you just limit it to a certain number of characters, for example, and then the rest displays when you open the item?  Or maybe throw a scroll bar in just that column?

    I have to be able to do this through designer/gui only if possible.  It's an enterprise SharePoint that I just control a portion of, so I have to jump through several weeks worth of hoops to get any custom code approved.

    Thursday, February 17, 2011 2:05 PM

Answers

  • I think I have what you are looking for.  Mike Smith recently wrote this article after I posted a thread begging for help in accomplishing this same task.

    http://techtrainingnotes.blogspot.com/2010/12/sharepoint-how-to-truncate-multiline.html 

    I tried it out and it works great, but I need to it handle multiple columns in the same list. I'm hoping he will update the script to limit characters in multiple columns.


    There are no mistakes; every result tells you something of value about what you're are trying to accomplish.
    • Marked as answer by Stanfford Liu Friday, February 25, 2011 3:11 AM
    Friday, February 18, 2011 6:45 PM

All replies

  • No worky.  I end up with #NAME? as the result in the ContentCalc and the Summary columns (using the article's example).
    Thursday, February 17, 2011 6:52 PM
  • Place the following script in a text file, make sure you have proxy settings set for the server. Add a CEWP to the list form and give the link of text file.

    The code I pasted is from EUSP.

    If it is MOSS 2007 you can follow this post

    This will help you for proxy.

    <script type="text/javascript">
    if(typeof jQuery=='undefined'){
    var jQPath = 'https://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js'
    document.write('<script src="',jQPath,'" type="text/javascript"><\/script>');
    }
    </script>
    <style type="text/css">
    .expandText {height:auto;}
    .collapseText {height:26px;overflow:hidden}
    </style>
    <script type="text/javascript">
    function ExpGroupRenderData(htmlToRender, groupName, isLoaded) {
    $("#tbod"+groupName+"_").attr("isloaded",isLoaded)
    .html(htmlToRender)
    .show("fast",collapseText("#tbod"+groupName+"_"));
    }
    function collapseText(group){
    if (!group) group = "#MSO_ContentTable";
    var html = "<img alt='collapseText' style='cursor:pointer;' src='/_layouts/images/menudark.gif'/>";
    $(group+" td.ms-vb2>div:has(>div)").toggleClass("collapseText")
    .prepend(html);
    $(group+" img[alt='collapseText']").click(function(event){
    $(event.target).parent().toggleClass("collapseText");
    });
    }
    $(function() {
    collapseText();
    });
    </script>
    Thursday, February 17, 2011 10:29 PM
  • I think I have what you are looking for.  Mike Smith recently wrote this article after I posted a thread begging for help in accomplishing this same task.

    http://techtrainingnotes.blogspot.com/2010/12/sharepoint-how-to-truncate-multiline.html 

    I tried it out and it works great, but I need to it handle multiple columns in the same list. I'm hoping he will update the script to limit characters in multiple columns.


    There are no mistakes; every result tells you something of value about what you're are trying to accomplish.
    • Marked as answer by Stanfford Liu Friday, February 25, 2011 3:11 AM
    Friday, February 18, 2011 6:45 PM
  • I'll try this - thanks!  This is exactly what I'm looking for!
    Friday, February 18, 2011 10:08 PM
  • Cool! and if you figure out how to change the JS to "fix" more than one column in the list, let me know!
    There are no mistakes; every result tells you something of value about what you're are trying to accomplish.
    Friday, February 18, 2011 10:12 PM
  • I followed the Mike's blog

    http://techtrainingnotes.blogspot.com/2010/12/sharepoint-how-to-truncate-multiline.html 

    and able to truncate the multiline text in Sharepoint 2010, but there are 2 issues i am facing as mentioned below

    1) OnClicking "More" option it's redirecting to item of the list, i want to expand the text onclicking "More" option in same view "AllItem.aspx" and also the width of the multiline text is expanding even the text is truncated

    2) If list contains the Lookup field then on Clicking the option "More" it's redirecting the item of the lookup list, i want to expand the text onclicking "More" option in same view "AllItem.aspx" on mouse hover on "More" it's pointing to Lookuplist url(not sure why)

    Tuesday, November 1, 2011 10:10 AM