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

[Solved] Group Header cells are moved after horizontal scrolling

3 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Geoff Ballard
Top achievements
Rank 1
Geoff Ballard asked on 15 Feb 2013, 02:22 PM
Hi

I have implemented some custom code (which came from elsewhere on the site) as I want the data in the headers to appear over the relevant column.  I get a problem when using the Frozen columns feature in that after horizontally scrolling to the right and then back to the left the contents of the columns shifts to the right.  I've posted a couple of screenshots below.  I can see that a colspan is added to the first column in the header row as the view is scrolled back.  Anyone seen this before? 

Versions are : asp.net 4.0, Windows 7, I.E. 8.0.7601.17514, RadGrid 2012.3.1308.40.

Thanks

Before


After


Code for setting up the group header:

protected void RadGrid_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridGroupHeaderItem)
        {
            (e.Item as GridGroupHeaderItem).DataCell.Visible = false;
            e.Item.PreRender += new EventHandler(Item_PreRender);
        }
    }
 
    void Item_PreRender(object sender, EventArgs e)
    {
        GridGroupHeaderItem groupHeader = sender as GridGroupHeaderItem;
 
        if (groupHeader != null)
        {
            for (int i = 3; i < groupHeader.OwnerTableView.RenderColumns.Length; i++)
            {
                if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnOne")
                {                   
                    groupHeader.Cells[i - 1].Text = string.Format("<nobr>{0}</nobr>", "One");
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnTwo")
                {
                    groupHeader.Cells[i - 1].Text = "Two";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnThree")
                {
                    groupHeader.Cells[i - 1].Text = "Three";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnFour")
                {
                    groupHeader.Cells[i - 1].Text = "Four";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnFive")
                {
                    groupHeader.Cells[i - 1].Text = "Five";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnSix")
                {
                    groupHeader.Cells[i - 1].Text = "Six";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnSeven")
                {
                    groupHeader.Cells[i - 1].Text = "Seven";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnEight")
                {
                    groupHeader.Cells[i - 1].Text = "Eight";
                }
                else if (groupHeader.OwnerTableView.RenderColumns[i].UniqueName == "ColumnNine")
                {
                    groupHeader.Cells[i - 1].Text = "Nine";
                }               
            }
        }

3 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 20 Feb 2013, 09:42 AM
Hello Geoff,

If I understand the requirements correctly you are trying to implement static headers when using grouping. Is there a reason why you can not use the build in static headers functionality? You can enable static headers using this code snippet:
<ClientSettings >
        <Scrolling UseStaticHeaders="True"  />
        </ClientSettings>

All the best,
Angel Petrov
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
Geoff Ballard
Top achievements
Rank 1
answered on 25 Feb 2013, 09:05 AM
Hi

I am using that setting.  The reason I don't use the standard functionality is that I need the information to appear in columns above the summed data rather than as a summary.  I have an example of this in a stand-alone project I can send to you if that helps.

Thanks

Stephen
0
Angel Petrov
Telerik team
answered on 28 Feb 2013, 08:52 AM
Hi Stephen,

I have consulted with our developers to see if the approach you are trying to implement is applicable and it appears that this functionality could not be handled by the RadGrid control in its current implementation. Generally this is a custom scenario and is out of our support scope and we can not guarantee that your custom implementation will work in all cases.

All the best,
Angel Petrov
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.
Tags
Grid
Asked by
Geoff Ballard
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Geoff Ballard
Top achievements
Rank 1
Share this question
or