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

Prevent scrolling grid when data is added

4 Answers 255 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anders Bergman
Top achievements
Rank 1
Anders Bergman asked on 09 Oct 2009, 10:29 AM

Consider the following scenario:

 

A grid populated with data, sorted and grouped by one column.

The row count is larger enough to enable scrollbars to be visible.

Data is added continuously to the grid. When added it is sorted in to the grouped list.

 

What we would like to achieve is that the current selected row(s) in the grid is “staying still” relative to the grid viewport when data is added to the grid.

 

We created a test project using Telerik WPF RadGridView, no specific settings in to the grid in XAML, and provided a mock datasource which added one row per second.

 

What happens is when data is added and sorted in “before” the selected row, the selected row is pushed down, out of the viewport.  

 

Is it possible to have Telerik WPF RadGridView behave as mentioned above, the current visible rows stays put in the viewport even though rows are added above them in the grid?

4 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 13 Oct 2009, 06:44 AM
Hi Anders Bergman,

RadGridView have BringDataItemIntoView method that will make the item (the row to be precise) visible.
Will this help you?
If you are talking about frozen rows - it is feature that we will try to implement after Q3 release (Q3 Service Pack 1 most probably).

Best wishes,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Anders Bergman
Top achievements
Rank 1
answered on 13 Oct 2009, 08:51 AM
Thanks for your answer which brought new light to the issue.

Frozen rows are not what we are looking for.

BringDataItemIntoView does seem to take us halfway where we want to be. It has two problems as far as we can see:
  1. It does bring the selectedItem (in our case) in to view, but as the method name implies, only in to view and not to a set position in the viewport. We would like for the selected row's vertical position in the viewport to be persisted even though new rows are added and sorted in above the current selected row.
  2.  It does not (as far as our tests goes), work when the grid has grouped columns.

Is there anyway to achieve what we want to do? If not possible now, is there any development being done that could resolve our problems, and in that case - is there a time frame for this that you can share?

Best regards and thanks for help!
0
Hristo
Telerik team
answered on 16 Oct 2009, 06:41 AM
Hello Anders Bergman,

The only way I can think of is to call GridViewScrollViewer SetVerticalOffset method after you add new row. Unfortunately this method is not available in the current release but it will be with the Q3. We are thinking of adding public get property of type GridViewScrollViewer in GridViewDataControl (the base class of RadGridView).
As for the BringDataIntoView not working in grouped scenario - this is fixed in the latest internal build.

Let me know if this is acceptable for you.

Regards,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Marcus
Top achievements
Rank 1
answered on 01 Jul 2013, 11:29 AM
Hi,

I also need this behaviour for our grid - if I'm scrolled halfway down the loaded collection, we need a way for the scroll viewport not to change when items are added to the grid.

Has anything been added since this thread that would enable this easily?

Thanks.
Tags
GridView
Asked by
Anders Bergman
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Anders Bergman
Top achievements
Rank 1
Marcus
Top achievements
Rank 1
Share this question
or