This is a migrated thread and some comments may be shown as answers.

[Solved] Prohibit multi-line for rows in one column

4 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Victor
Top achievements
Rank 1
Victor asked on 22 May 2012, 05:21 PM
Hi!

Is there any way to prohibit the automatic "multilining" of cells in the grid where there is too much content? That is, I would like to transform what is now showed as:
 
  Content1, Content2,
  Content3, Content4,
  Content5

To:

  Content1, Content2...

(including the ellipsis), thus making each row only one line high. In the end I would also like to show a tooltip (title) on hover showing the full text.

Is this possible?

Thanks
/Victor

4 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 24 May 2012, 12:49 PM
Hi,

Similar to your question is already covered in this forum thread:
http://www.telerik.com/community/forums/aspnet-mvc/grid/show-ellipsis-when-cell-content-is-larger-than-the-specified-width.aspx 

You can use the CSS shown there to display the rows on a single line.
i.e.
.t-grid  td
{
    white-space:nowrap;
}


Regarding the full text on hover you can use jQuery (via the OnDataBound event or OnLoad for server binding) to set the title attribute to be equal to the content of the cell.
$('.t-grid td').each(function(){
    $(this).attr('title',$(this).text())
})


Greetings,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Victor
Top achievements
Rank 1
answered on 24 May 2012, 01:52 PM
Thanks, that solves most of the problem.

However the really nice feature with the ellipsis (...) is gone - is there any way to have that as well? Something like this:

| Cell 1     | Cell 2     | Really long cell with a lot of co |

becomes:

| Cell 1     | Cell 2     | Really long cell with a lot of...  |


Thanks again
/Victor
0
Accepted
Pechka
Top achievements
Rank 1
answered on 24 May 2012, 03:13 PM
Yo

Make sure you have added :
text-overflow: ellipsis;
rule along with the :
white-space: nowrap;
0
Victor
Top achievements
Rank 1
answered on 24 May 2012, 03:31 PM
Oh!

Thanks a lot! Didnt realize it was a simple css rule, thought it was all Telerik magic! :)

/Victor
Tags
Grid
Asked by
Victor
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Victor
Top achievements
Rank 1
Pechka
Top achievements
Rank 1
Share this question
or