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

Grid, fixed row height ( no word wrap, no multi line )

10 Answers 4068 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elko
Top achievements
Rank 1
Elko asked on 04 Apr 2013, 04:21 PM
Hi,

is it possible to set a fixed row height in grid, and suppress word wrapping / multi line, so that
each row has the same hight.

I have seen some examples to solve it like

.k-grid table {
    table-layout: fixed;
}

but doesn't really work.

Thanks
Thomas

10 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 08 Apr 2013, 10:10 AM
Hi Thomas,

You can achieve this using custom CSS. For example: 
.k-grid tbody tr{
    height: 50px;
}
 
.k-grid td{
    white-space: nowrap;
}

Regards,

Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Accepted
Elko
Top achievements
Rank 1
answered on 08 Apr 2013, 12:15 PM
Hi Iliana,

Perfect,  thank you very much.

Regards Thomas
0
SEAN
Top achievements
Rank 1
answered on 20 Jul 2014, 03:35 PM
The solution given here forces all rows to be the same fixed height, is there a way to still have dynamic sizing, but with a maximum row height? So if there is a small amount of text then the row would dynamically size to the height of one line of text, but if the text is longer then the row would increase to show multiple lines of text, but only up to a given maximum, so perhaps show up to three lines of the text, but don't dynamically expand higher than that?

I'd be fine with having to set the height in pixels rather than lines of text, but I'd really like to be able to have a maximum height when using dynamic sizing.
0
Binny
Top achievements
Rank 1
answered on 21 Jul 2014, 10:50 AM
It didnt work for me:(
0
Binny
Top achievements
Rank 1
answered on 21 Jul 2014, 10:50 AM
Hello Telerik,


One of the column in my Kendo grid is the Notes Column (which has atleast 3000 characters). 

Now the problem I'm facing is the grid cell expands to the size of the characters. It makes my cell huge.

I would like to make the grid cell single line with a fixed amount of characters and have a tooltip on the cell.

I'm not sure whether I can achieve it. 

Please let me know the possible solution for the above case.

Sample data in a cell  in  the Column (Notes):


<div><b>17/11/2010</b> - Not received many enquiries, uses Extra Sure and Holmans. Finds our Medical Screening too lengthy. Took her through system and printed off Mes Screen questions, will use us more than N J Heritage. She will aim to use us for new enquiries.</div><div><br></div><div><b>16/02/11</b> - L/M - R/C.</div><div><br></div><div><b>08/03/2011</b> - JCO - Spoke to Matthew Salmon, not finding us competitive been using ExtraSure who are a lot cheaper. Advised our USP's and our benefits. Will use us for next travel enquiry.</div><div><b><br>16/06/11</b> - Jane spoke to Richard and will be taking him through the system, SunWorld Plus.</div><div><br></div><div><b>12/10/11</b>-I Have spoken to Richard, I have emailed across details of Sunworld Extra &amp; medical screening along with Username &amp; Password. MP</div><div><br></div><div><b>01/11/2011 </b>- JCO spoke to Richard, Richard issuing a quotation today, likes that we don't have any age limits and restricted to 85 on AMT policies. &nbsp;First time to use us, usually use Citybond, likes the look of our product. JCO advised to contact me if requires detailed explanation of system.&nbsp;</div><div><br></div><div><b>25/05/12</b> - MW - Spoke to Richard, he is very nice, I thanked them for their continued support in using SunWorld and I am sending him the email with the Special Features and the SunWorld Extra info.. He said he rates SunWorld 8 and a half out of ten because he would like to see the option to increase the single article limit and also the rates have gone up quite a bit recently.. He said they don't really do that much travel but they are going to be pushing it over the next year because he said he thinks people are getting fed up of going on the internet to get insurance and realising they aren't actually covered for anything... He is generally happy with everything.</div><div><br></div><div><b>08/08/12</b> - MW - Spoke to Luke, I asked why they hadn't used us since June and he said it was just because of a slow down in enquiries. &nbsp;Travel is not something they push, they just offer it to accommodate their existing clients. &nbsp;He said the only use us and one other provider so any enquiries they do get they always quote with us, he has done some quotes this week but they haven't come back. &nbsp;They are very happy with everything. &nbsp;No problems etc. &nbsp;I am sending him the Special Features for 2012 and also SunWorld Extra info,</div><div><br></div><div><b>16/08/12</b> - MW - Spoke to Richard, asked if they would be interested in having a <span class="wysiwyg-color-red"><b>poster</b></span>, he said it would not really be of any use to them as they are not a high street broker, they are in an office and not customer facing, he said they don't really do much travel, they are mainly a commercial broker but they are happy with any travel business they can do, what they would like is a flyer as opposed to a poster so they can email it out to their customers. &nbsp;He said he thinks the product is great, likes the age limits and limits etc,<br><br><b>14/11/12 -&nbsp;</b>MW - Spoke to Luke, told him about <span class="wysiwyg-color-green"><b>Snowman Cover</b></span> and Broker <span class="wysiwyg-color-blue"><b>Survey</b></span>.<br><br><b>04/12/12</b> - MW - Spoke to Luke, he said they are really quiet at the moment. &nbsp;Only using SunWorld but just not getting the enquiries. &nbsp;he is happy with SunWorld though and I have told him about the <b>Changes for 2013.<br></b><br><b>08/02/13</b> - MW - I can see that they said back in August that they would like some leaflets so I am sending them some out.<br><br><b>28/02/13</b> - MW - Luke has sent this email &nbsp;- "Sorry, not sure if you are still doing this but can we havesome leaflets to send with our renewals to try and offer your services J thanks" , So I am sending them out some more leaflets.<br><br><b><span class="wysiwyg-color-yellow">01/05/13</span> -&nbsp;</b>MW - Spoke to Richard, he said the main person who does the travel, Luke, is on holiday in Turkey for the rest of the week and will be back on Tuesday. &nbsp;I have made a note in my diary to give him a call back on Wednesday.<br><br><b><span class="wysiwyg-color-yellow">08/05/13</span></b> - MW - Spoke to Luke, he said SunWorld are their main travel provider, they have not really had many enquiries for travel lately. &nbsp;He said our rates are competitive for annual but people can get travel insurance so cheap online now that he thinks they have just been doing that. &nbsp;I said we will reduce the rates for him and he said that would be good. &nbsp;They are also set up to use us via the AXA route which he said is fine to be deactivated and they will carry on using this one as they have been. &nbsp;He said he would like some leaflets as he never received the last lot so I have checked his address and I am sending out 20 more. &nbsp;I told him about the new product and I am sending him the email with the Underwriting Changes and Special Features for 2013. <span class="wysiwyg-color-red"><b>RATES REDUCED<br></b></span><br><b><span class="wysiwyg-color-yellow">01/07/13</span></b> - MW - Spoke to Luke, he said they are only using SunWorld so they must have not had any enquiries and that's why they haven't used us in the last month. &nbsp;He said they only really offer travel insurance to accommodate their existing clients, they don't really push for it. &nbsp;He said they have got the leaflets and they will be sending them out with renewals etc. &nbsp;As soon as they get the enquiries, we will be getting the business.<br><br><b><span class="wysiwyg-color-green">13/09/13</span></b> - MW - Spoke to Richard, told him about the new product going live on the 1st October. &nbsp;I am sending him the email with the Underwriting Changes and Special Features for 2013. &nbsp;He said they would like some leaflets so I have confirmed their address and I am sending out 20.<br><br><b><span class="wysiwyg-color-yellow">01/11/13</span><span class="wysiwyg-color-green">&nbsp;</span> -&nbsp;</b>MW - Spoke to Richard, he said they are very quiet at the moment, their customers are not going away and that's why they haven't issued anything. Luke is the main person who deals with this and he will be our contact going forward because he is the one who deals with it most of the time. &nbsp;I told Richard about the video tutorial and he is going to tell Luke and he will let us know if he has any queries. &nbsp;I am sending the email with the New Special Features and further information on the changes we have made to the website. luke.robson@aifltd.co.uk<br><br><b><span class="wysiwyg-color-yellow">02/01/14</span> -&nbsp;</b>MW - Spoke to Luke, I have confirmed all the contact information is correct and I have added his email address to the spreadsheet for the 2014 mailer and then he will forward it around to all the others. &nbsp;He said they only use SunWorld and it is the easiest to use, they just haven't had any enquiries for travel. &nbsp;I am sending him the email with the New Special Features and information about the changes we have made to the system. &nbsp;He said he has asked for some leaflets before but he has not received them. &nbsp;He really wants some to send out with all his renewals so I am sending him out 60 leaflets.<br><br></div>
0
Iliana Dyankova
Telerik team
answered on 22 Jul 2014, 11:25 AM
Hello guys,

@Sean
For this requirement I would suggest to use a column template - wrap the cell content in a <div> element with a set max-height and an overflow:hidden style.

@Binny
For this requirement you can use the following CSS rules: 
.k-grid table {
   table-layout: fixed;
}
  
.k-grid td{
   white-space: nowrap;
   text-overflow: ellipsis;
}

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 

.k-grid table {
   table-layoutfixed;
}
 
.k-grid td{
   white-spacenowrap;
   text-overflow: ellipsis;
}

.k-grid table {
   table-layoutfixed;
}
 
.k-grid td{
   white-spacenowrap;
   text-overflow: ellipsis;
}

0
Robert
Top achievements
Rank 1
answered on 08 Aug 2014, 12:57 AM
Hmmm. I have somewhat pickier needs for some of my data. I wish to have two lines with ellipsis.

Haven't tried it yet, but would something like:

.k-grid td {
    overflow: hidden;
    text-overflow: ellipsis;
}
have any chance of working? Obviously I will do my own experimenting, but wanted to get seasoned Telerik users' thoughts.

Just had to post this question, brand new to Telerik as of today!



0
Iliana Dyankova
Telerik team
answered on 11 Aug 2014, 06:16 PM
Hi Robert,

If I understand correctly you would like to use text-overflow: ellipsis on multiline text? If this is the case I am afraid it is not supported by Kendo UI Grid - there is no such feature in HTML.

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Robert
Top achievements
Rank 1
answered on 11 Aug 2014, 06:26 PM
Hi Iliana,

Yes, I am aware that the pseudo-code I submitted is not valid per se. I am trying to see how I can set a fixed row height and force an ellipsis if the text doesn't fit in the allotted height.

Another alternative that would be nice would be to show a tooltip *if* the text overflows, but not otherwise.

Thanks, Bob
0
Iliana Dyankova
Telerik team
answered on 13 Aug 2014, 10:49 AM
Hi Bob,

Thank you for the details. Up to the scenarios
- ... how I can set a fixed row height and force an ellipsis if the text doesn't fit in the allotted height...
Please take a look at this example which demonstrates a possible implementation;
- ...Another alternative that would be nice would be to show a tooltip *if* the text overflows, but not otherwise...
I would recommend to check this forum thread which discussed a similar subject. 

Regards,
Iliana Nikolova
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Elko
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Elko
Top achievements
Rank 1
SEAN
Top achievements
Rank 1
Binny
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Share this question
or