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

Scroll child grid with parent

3 Answers 287 Views
GridView
This is a migrated thread and some comments may be shown as answers.
vzaytzev
Top achievements
Rank 1
vzaytzev asked on 16 Mar 2010, 10:42 AM
I have hierarchical grid with parent and child grid. Both grids have horizontal scroll bars. But now child gird scrolls independent from parent grid. Is it possible to scroll child grid when user scrolls parent grid?

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 17 Mar 2010, 01:27 PM
Hi Vasily,

Thank you for contacting us.

Currently this is not possible, however, this is an interesting suggestion. Could you please describe in more detail the situation that requires such behavior and we will consider it when planning our future versions.
 

Regards,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
vzaytzev
Top achievements
Rank 1
answered on 17 Mar 2010, 05:17 PM
Thank you for your answer!

I have two-level grid, child grid has exactly same columns as parent grid. Columns should have same size, same order and same alignment. I've solved this by handling ColumnWidthChanged event. But parent and child grids sroll independenlty, that was a problem. I solved it by scrolling whole grid in Panel control, not rows in grid.

Also, what is the correct way to calculate grid's actual width? I'm not sure that summarizing columns' width is correct.
And which event fires when all rows finished calculating their width?
0
Jack
Telerik team
answered on 19 Mar 2010, 05:56 PM
Hello vzaytzev,

If I understand correctly, you are describing a self-referencing hierarchy. We plan to add support for this hierarchy mode in our next release - Q2 2010. Find more detail in this blog article.

RadGridView calculates the column width in several cases, for example when column pinned state has changed, or when column width is changed. To calculate the desired width you can use the following code:
int width = 0;
foreach (GridViewColumn column in this.radGridView1.ViewDefinition.RenderColumns)           
{
    width += this.radGridView1.ViewDefinition.GetColumnWidth(column);
    width += ((GridTableElement)this.radGridView1.GridElement).CellSpacing;
}
if (this.radGridView1.GridElement.VScrollBar.Visibility == ElementVisibility.Visible)
{
    width += this.radGridView1.GridElement.VScrollBar.Size.Width;
}

You need to extend this logic to support child views. I hope this helps.

Regards,
Jack
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
vzaytzev
Top achievements
Rank 1
Answers by
Jack
Telerik team
vzaytzev
Top achievements
Rank 1
Share this question
or