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

resizeToFit without Header row

3 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jarod
Top achievements
Rank 1
Jarod asked on 27 May 2014, 04:20 PM
I followed the instructions here to auto resize my columns, but this doesn't appear to work if ShowHeader = false.  

http://www.telerik.com/help/aspnet-ajax/grid-gridcolumn-resizetofit.html.  

If ShowHeader = false, it looks like it resizes the columns so that the whole table is 100% of the screen, ore maybe even a bit more.  Is there a workaround for this?  Could I hide the header row on the client side after running resizeToFit()?


3 Answers, 1 is accepted

Sort by
0
Accepted
Venelin
Telerik team
answered on 30 May 2014, 08:10 AM
Hi Jarod,

You are correct, this can be improved. I have logged your request into our system so our developers can fix it as soon as possible. Until then I can propose you a temporary workaround:

CSS:

.RadGrid .rgMasterTable{
   width: auto !important;
}

Just add the above CSS to your page styles.

Regards,
Venelin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jarod
Top achievements
Rank 1
answered on 02 Jun 2014, 01:28 PM
Thanks Venelin.  I had to add 

div.RadGrid {
  display:inline-block;
}

to get the surrounding box to shrink to fit the table, but it works.  Now I just need to figure out how to get that box to center on the page, since setting display to inline-block won't center it using margin: auto.
0
Jarod
Top achievements
Rank 1
answered on 02 Jun 2014, 01:35 PM
Adding a css class with text-align:center; to the parent element got this to center.
Tags
Grid
Asked by
Jarod
Top achievements
Rank 1
Answers by
Venelin
Telerik team
Jarod
Top achievements
Rank 1
Share this question
or