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

Column headers not aligning as per width settings in IE8

1 Answer 320 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mohit
Top achievements
Rank 1
Mohit asked on 01 Mar 2013, 10:12 PM
I have a simple grid bound to server data (asp.net mvc). I noticed that in IE8 (or IE9 compatibility view), the grid column headers don't respect the width settings. However, the actual column data does. See attached image (grid not aligned.png).
Here's my razor code - 
<div id = "griddisplay">
         @(Html.Kendo().Grid(Model)
            .Name("MyGrid")
            .Columns(columns =>
                {
                    columns.Bound(p => p.RegionId).Title("Region ID").Width("100px");
                    columns.Bound(p => p.RegionName).Title("Region Name").Width("150px");
                })
            .Pageable()
            .Resizable(r=>r.Columns(true))
            .Sortable()
            .Scrollable(scr => scr.Height("200px"))
            .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("GridTest", "MyController")
                )
            )
         )
    </div>
The only style I have applied is this -
#griddisplay {width:520px;font-size:12px}
I did notice that -
1) It works correctly in IE9 and Chrome all the time (with our without resizable() configuration).
2) I want my column non-resizable. But if I make them resizable, then initially the columns render mis-aligned (in IE8) as in the image but as soon as I try to resize a column by dragging the column header, they all immediately line up correctly. So, it's just the initial layout that is not respecting the width settings I believe.

I'm using the Kendo mvc library version 2012.3.1315.340 (trial version).

Any idea of what I need to do to make it work in IE8?

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 04 Mar 2013, 03:04 PM
Hello Mohit,

Pixel widths for all Grid columns should be used only when your goal is to have a horizontal scrollbar. Otherwise at least one column should have no width, so that it can adjust and fill the remaining horizontal space. In case you require a narrower Grid, then please set an appropriate width to the widget itself.

Currently the Grid looks OK in non-IE browsers, because they ignore inconsistent column widths and expand the columns to fill the <table>. However, this has negative side effects and should not be tolerated.

Let me know if you need more information.

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Mohit
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or