1

I have created a discussion board web part but the body column displays the whole body of the discussion. I would like to reduce it so that it only shows the first line or two of the body column.
What it currently looks like

What i would like it to look like

If the images dont illustrate, i would like to limit the number of lines displayed in the body column on the web part to just the first two lines.

Hope this makes sense.

Thanks in advance!

Mike

2 Answers 2

2

This is a ugly way to do it but it might work for you if you just need it as a quick fix and nothing to serious.

This will change the height of the actual multiple lines of text field to only "display" one or two rows. Hovering over the field will expand and show the full text.

<style type="text/css">
.ms-vb2 .ms-rtestate-field {
    overflow: hidden;
    line-height: 16px;   
    max-height: 56px; /*change this height to show more or less rows*/
}
.ms-vb2 .ms-rtestate-field:hover {
    max-height:none;
}
</style>

The screenshot shows the same list item, while not hovering over it and while hovering.

enter image description here

4
  • Thanks - This sounds like it will be sufficient. Will try it as soon as time allows and get back to you. Thanks again.
    – MrrMan
    Jun 19, 2017 at 8:13
  • A little late - Seems to look good until i save the page and then it reverts back...?
    – MrrMan
    Aug 8, 2019 at 11:03
  • Haha, cool that you made it back after all this time. There can be 2 reasons i can think off: 1: is minimal download strategy enabled? Or if there is some kind of check out process.. but I don't think that you are able to check out a listview.. Aug 8, 2019 at 11:05
  • Thanks - no check out. I was about to disable MDS earlier but i am a little unsure of its impact on other features throughout the environment. And if i turn it back on, do whatever changes happen when it gets turned off get reverted? Also, does it change the links at all, because someplaces have hard coded links that may break. Thanks again!
    – MrrMan
    Aug 8, 2019 at 15:12
0

Take a look at JSLink or so called Client Side Rendering. With this you can transform any column to your specification and render it as you would prefer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.