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

Set column width using table initialization

1 Answer 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 26 Sep 2013, 10:20 PM
I am initializing a grid using an html table, including 

       <table id="grid">
           <colgroup>
               <col style="width:50px" />
               <col style="width:25px" />
               <col style="width:25px" />
           </colgroup>
           <thead>
               <tr>
                   <th>Hour</th>
                   <th>10 AM</th>
etcetera
However, the columns seems to blithely ignore the instructions.  The table should be as large as necessary to accommodate all of the columns.  What is missing or going askew here?

Thanks.

Here is the fiddle I am using to prototype:  http://jsfiddle.net/raltman/wcD28/5/

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 27 Sep 2013, 10:17 AM
Hello Robert,

The Grid's outermost element is a <div>. The Grid table in it has a 100% width style, so it expands to fill the Grid <div>, which is 100% wide by default (being a block-level element).

You can achieve the desired behavior by disabling the Grid <div> and <table> auto expand behavior:

http://jsfiddle.net/dimodi/wcD28/9/

Regards,
Dimo
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
Robert
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or