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

Issue with RadGrid div resizing on header mouseover or scroll in IE9

6 Answers 231 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ANDREW
Top achievements
Rank 1
ANDREW asked on 04 Dec 2012, 05:16 AM
Hi,

I am having an issue with a RadGrid which appears to only occur in IE9. The issue only occurs if I enable AllowScroll in the client settings. When I mouse over the column headers or click on the horizontal scrollbar what I believe is the outer RadGrid div is growing in size leaving a blank space between the grid contents (and horizontal scroll) and the surrounding border. The grid itself has a two level hierarchy and expanding/collapsing any of the items causes the outer div to resize itself back.

Running IE9 in IE7/IE8 or IE9 compatibility mode does not show the problem. It appears to only occur in IE9 itself. 

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="ObjectDataSource1" OnColumnCreated="RadGrid1_ColumnCreated"
    OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound" OnExportCellFormatting="RadGrid1_ExportCellFormatting" Width="100%">
    <MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="Client" AllowSorting="false"
        DataKeyNames="EventGroupTypeId, ParentEventGroupTypeId" TableLayout="Fixed">
        <SelfHierarchySettings ParentKeyName="ParentEventGroupTypeId" KeyName="EventGroupTypeId" />
    </MasterTableView>
    <ClientSettings AllowExpandCollapse="true">
        <Scrolling AllowScroll="true" />
        <ClientEvents OnGridCreated="GridCreated" />
    </ClientSettings>
</telerik:RadGrid>

I also have some css to force the height to auto: 


.rgDataDiv { height: auto !important }

I have found that the problem appears to only occur if I set the Grid width in JS. This is done in the OnGridCreated client event using the following code:

function GridCreated(sender, args) {
    ResizeGrid();
}
 
function ResizeGrid() {
    var grid = $find("<%= RadGrid1.ClientID %>");
     
    grid.get_element().style.width = ($(window).width() - 140) + "px";  // <-- with this line included, the problem shows. Without it, the problem doesn't show but the grid also goes off the screen (large number of columns)
}

The 140px offset is simply to allow for a page border. The ResizeGrid function is only ever called the once (through the GridCreated function). 

Is there another way to set the Grid width that would be better suited? This appears to be the recommended way to do this as per Telerik support (http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-width-and-height-in-javascript-dom.aspx)

I have some screen captures showing the issue if that helps? Just let me know how you would like me to get them to you.

Cheers,

Andrew

6 Answers, 1 is accepted

Sort by
0
ANDREW
Top achievements
Rank 1
answered on 04 Dec 2012, 07:44 AM
Hi,

I have managed to create a work around by forcing the page to run in IE8 compatibility mode if someone tries to use IE9.. Placing the following in the Page_PreRender should do it..

if (Request.Browser.Browser == "IE" && Request.Browser.MajorVersion == 9)
{
    System.Web.UI.HtmlControls.HtmlMeta metaTag = new System.Web.UI.HtmlControls.HtmlMeta();
    metaTag.HttpEquiv = "X-UA-Compatible";
    metaTag.Content = "IE=EmulateIE8";
 
    Page.Header.Controls.AddAt(0, metaTag);
}

The reason I have had to use a programatically solution is because I have theming enabled which was inserting the stylesheet link as the first element after the head and as such IE was ignoring the meta tag due to the link tag forcing it to assume std IE9 mode

Cheers,

Andrew
0
Josh
Top achievements
Rank 1
answered on 23 Jan 2013, 11:47 PM
I am having a similar issue in IE9. I have horizontal scroll bars enabled. When I mouse over the grid, the space below the scrollbar but above the pager grows indefinitely.
0
Galin
Telerik team
answered on 28 Jan 2013, 03:20 PM
Hello Josh,

There is a similar known bug in IE9, when the RadGrid is wrapped in container with overflow: auto. It can be reproduced with regular HTML elements as well.

However, you can fix it by setting either display: inline-block on this grid's wrapper or on the data container, e.g.
._Telerik_IE9 .rgDataDiv
{
    display: inline-block;
}

I hope this helps.

All the best,
Galin
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 RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Josh
Top achievements
Rank 1
answered on 30 Jan 2013, 10:52 PM
Galin,

That worked perfectly.


Thank you,
0
Ketan
Top achievements
Rank 1
answered on 17 Jul 2013, 06:20 AM

Hi,

Issue related to the growing of dock size on mouse over is fixed by setting 'display: inline-block;' on div containing rad grid, but scrolling stopped working i.e. after applying this fix original issue is fixed but horizontal scroll bar is not appearing.

We are applying below css over div containing rad grid:
RadGridHorizontalScroll
{
    overflow-x: auto;
    overflow-y: hidden;
    width: 99%;
    padding: 8px 0 20px 0;
    width: auto;
    display: inline-block !important;
}

0
Ketan
Top achievements
Rank 1
answered on 17 Jul 2013, 09:12 AM
Hi,

Issue is resolved by removing "width : Auto"  style and setting "Display: Inline-Block".

Thanks,
Tags
Grid
Asked by
ANDREW
Top achievements
Rank 1
Answers by
ANDREW
Top achievements
Rank 1
Josh
Top achievements
Rank 1
Galin
Telerik team
Ketan
Top achievements
Rank 1
Share this question
or