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

RadGridView scrolls to end

11 Answers 559 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anisha
Top achievements
Rank 1
Anisha asked on 25 Aug 2010, 10:34 PM
My grid has grouping enabled. when i expand the group, and if the grid has a horizontal scrollbar, the grid automatically scrolls to the rightmost column. 
Any clues as to why it could be doing this? Is there a property I can enable/disable to prevent this from happening. 
Or workarounds?

Thanks
Anisha

11 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 26 Aug 2010, 03:10 PM
Hi Anisha,

Thank you for contacting us. I confirm that this issue appears in our latest release. We plan to address it in our upcoming service pack in the beginning of September. I hope this is not too late. 

If you have further questions, please write back.

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
Anisha
Top achievements
Rank 1
answered on 26 Aug 2010, 03:15 PM
Thanks!!
0
George Saveliev
Top achievements
Rank 1
answered on 14 Oct 2010, 04:43 PM

Hello!


It seems that this issue is not fully fixed in v.2010.2.10.914.

I created a form with a grid bound to the BindingSource. All properties are set to default values.


01.public partial class MainForm : Form
02.{
03.    public MainForm()
04.    {
05.        InitializeComponent();
06. 
07.        DataTable dt = new DataTable();
08.        dt.Columns.Add("Group", typeof(int));
09.        for (char c = 'A'; c <= 'Z'; c++)
10.            dt.Columns.Add(c.ToString(), typeof(string));
11.        for (int i = 0; i < 100; i++)
12.            dt.Rows.Add(i / 10);
13. 
14.        bindingSource.DataSource = dt;
15. 
16.        radGridView.MasterTemplate.GroupDescriptors.Add("Group", ListSortDirection.Ascending);
17.    }
18. 
19.    protected override void OnLoad(EventArgs e)
20.    {
21.        base.OnLoad(e);
22.        bindingSource.Position = 5;
23.    }
24.}

Please note, that the bindingSource.Position is set in the OnLoad() method, not immediately in the constructor. This causes the grid be horizontally scrolled to the end.


If I set the breakpoint at line 22 and watch radGridView.CurrentColumn, I see that it is set to the first grouped column "Group". So, it seems that this causes the issue, because setting it to non-grouped column solves the issue:


1.bindingSource.Position = 5;
2.radGridView.CurrentColumn = radGridView.Columns[1];

I hope this will help to locate the issue reason.


Thank you.

0
Jack
Telerik team
answered on 15 Oct 2010, 11:28 AM
Hello George Saveliev,

Thank you for reporting this issue and for the detailed description. We did not managed to include the fix in our last service pack, so it will be addressed in our next major release - Q3 2010. If you have other questions, I will be glad to help.

Greetings,
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
George Saveliev
Top achievements
Rank 1
answered on 16 Oct 2010, 01:32 PM

Hello!


JFYI: The same issue with scrolling also occurs if the first grid column is not included into any column group and it becomes the current column after the binding source change.


Thank you.

0
Jack
Telerik team
answered on 21 Oct 2010, 08:51 AM
Hi George, thank you for these details. We will take them into consideration when addressing the issue. 
 
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
Alex
Top achievements
Rank 1
answered on 29 Oct 2010, 10:26 AM
Hello everyone,

I also have the similar question about scrolling. Is there any way to dispable scrolling to the end of the row after clicking the last cell?
I'am using full row selection mode and it is not good for me when gridview scrolls to the end after clicking the last visible cell. I just want
to allow user to scroll gridview using scrollbars only. Right now I'am using

RadGridView.TableElement.ColumnScroller.ScrollToItem(firstColumn); in RadGridView_CellClick() event, but all movings are visible on the screen.

0
Jack
Telerik team
answered on 03 Nov 2010, 03:50 PM
Hello Alex,

You can do this by replacing the default grid behavior with a custom one. Please consider the following code snippet:

this
.radGridView1.GridBehavior = new CustomGridBehavior();
 
public class CustomGridBehavior: BaseGridBehavior
{
    public override bool OnMouseDown(MouseEventArgs e)
    {
        GridCellElement cell = GridControl.ElementTree.GetElementAtPoint(e.Location) as GridCellElement;
        if (cell != null &&
            (cell.ControlBoundingRectangle.Right > cell.TableElement.ViewElement.ControlBoundingRectangle.Right ||
            cell.ControlBoundingRectangle.Left < cell.TableElement.ViewElement.ControlBoundingRectangle.Left))
        {
            cell.TableElement.BeginUpdate();
            int scrollbarValue = cell.TableElement.HScrollBar.Value;
            cell.ColumnInfo.IsCurrent = true;
            cell.RowInfo.IsCurrent = true;
            cell.TableElement.EndUpdate(false);
            cell.TableElement.HScrollBar.Value = scrollbarValue;
            return false;
        }
             
        return base.OnMouseDown(e);
    }
}

I hope this helps.

Best wishes,
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
Alex
Top achievements
Rank 1
answered on 03 Nov 2010, 05:18 PM
As I see this chunk of code is not trivial at all, but It works excellent )

Mega Respect!
0
Ryan
Top achievements
Rank 1
answered on 08 Dec 2010, 06:28 AM
I'm using Q3 of the Telerik Winforms controls and I'm having problems with the grid still scrolling to the most right column when I update my datasource with the radgrid having at least 1 grouped column.

If anyone has a workaround/quickfix for this it would help alot.

I also looked on the PITS section and only found this "Issue ID 3488 - FIX wrong scrolling when using column groups view in right to left mode" so I've reported the bug.
0
Jack
Telerik team
answered on 11 Dec 2010, 02:24 PM
Hello Ryan, thank you for reporting this issue. Could you please send us your application? This will allow us to ensure that the issue will be addressed in one of our upcoming releases. 

Should you have any further questions, do not hesitate to write back.

All the best, Jack
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
Tags
GridView
Asked by
Anisha
Top achievements
Rank 1
Answers by
Jack
Telerik team
Anisha
Top achievements
Rank 1
George Saveliev
Top achievements
Rank 1
Alex
Top achievements
Rank 1
Ryan
Top achievements
Rank 1
Share this question
or