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

Vertical Scrollbar issue -- when you delete and re-add items.

4 Answers 60 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Donald Hamm
Top achievements
Rank 1
Donald Hamm asked on 08 Jul 2009, 09:45 AM
Using the latest RadGrid, I've noticed if I have items in a grid (say 4) that cause a vertical scrollbar, I can scroll the grid to the bottom then I initiate an action that will cause that grid to 'reload' new items -- say just one or two.  If I don't 'scroll' to the top before I initiate the action, once the new items are loaded, the grid does not show them (just an empty grid) or will show just one (if 2 items were loaded) yet I can look @ the grid in debug mode and see it has the 1 or 2 new records.

If I load the previous items, scroll the grid back to the top (using the thumb or up/down arrows) and then initiate the action that loads the 1 or 2, the grid will load the items correctly and then show them.  I do use 'UpdateLayout()' after I've release the items (null), then added the items back:

 

this.RadGridQNoteDefects.ItemsSource = null;

 

 

 

 

this.RadGridQNoteDefects.ItemsSource = _ncds;

 

 

 

 

// in order for grid events to occur during loading, you need to

 

 

 

 

// call this first. This will cause the 'DataLoaded' event to occur...

 

 

 

 

this.RadGridQNoteDefects.UpdateLayout();

 

 

 


Is there anything I can do to force the grid to 'reset' the scroll position before or after loading the items?

(grid initial options below)

 

 

<telerikGridView:RadGridView x:Name="RadGridQNoteDefects" IsReadOnly="True" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" ColumnsWidthMode="Fill" CanUserFreezeColumns="False" DataLoadMode="Synchronous" >

 

 

 

Basically, it looks as if the grid is saving the 'last' scroll position in between data loads...

Thanks!

-Don

4 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 08 Jul 2009, 11:33 AM
Hello Donald Hamm,

This issue is already fixed and will be available with latest internal build next Friday. For now as a workaround you can use RadGridView.ItemsControl.VirtualizingPanel.SetVerticalOffset(0d) when you change data source of the RadGridView.

Sorry for the inconvenience caused.

Greetings,
Nedyalko Nikolov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Donald Hamm
Top achievements
Rank 1
answered on 08 Jul 2009, 12:01 PM
Fantastic!  Thanks for the reply!  I'll use that until the next build....  Great job folks!...
0
Wolfgang Colsman
Top achievements
Rank 1
answered on 29 Jan 2010, 09:04 AM
I have a similar problem with 00395RadControls_for_Silverlight4_2009_3_1322_Trial.zip.

1. I add e.g. 10 items and scroll down.
2. I call items.clear()
3. I add e.g. 20 items -> the thumb of the scrollbar is somwhere in the middle.

Ii do not find the ItemsControl property in GridView.

Regards

Wolfgang
0
Vlad
Telerik team
answered on 03 Feb 2010, 12:48 PM
Hello Wolfgang,

You can scroll the grid to the first item using ScrollIntoView() method:

RadGridView1.ScrollIntoView(RadGridView1.Items[0]);

All the best,
Vlad
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Tags
GridView
Asked by
Donald Hamm
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Donald Hamm
Top achievements
Rank 1
Wolfgang Colsman
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or