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

smooth data update?

4 Answers 89 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 1
Johnny asked on 12 Jul 2010, 08:28 AM
Hi,
I want to know, how can I update my data in a RadGrid smooth when my bound datasource has changed (only the values behind have changed no entries have been added or removed).

I use the PropertyChanged event or I call Rebind() and this updates the data, but the problem is,
that the selected item and the scroll postion gets lost. The grid jumps to the top to the first entry.
I can select the current Item and call ScrollIntoView(), but this doesn´t satisfy me.
ScrollIntoView() just scrolls until the item is visible, but before it could be in the middle of the screen, so when I update I have a jump of some rows and the selected item is on the top now.

What is the recommended way to do this?

Is there a way to silent update the data or read and set exacly the scroll position?

I hope I expressed me clear...

Regards,
Johnny

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Jul 2010, 08:41 AM
Hello Johnny,

 You do not need to call Rebind() in case of PropertyChanged since cell/columns Bindings will respond automatically. 

Best wishes,
Vlad
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
Johnny
Top achievements
Rank 1
answered on 12 Jul 2010, 08:54 AM
Hi,

I don´t call both,normally I use the ProprtyChanged  event, i just tried Rebind(9 I it works different.
But the problem remains the samewith ProprtyChanged, my scroll position gets lost.
Or what I´m doing wrong?

0
Vlad
Telerik team
answered on 12 Jul 2010, 09:21 AM
Hi Johnny,

 I've just tried our latest official version with INotifyPropertyChanged however everything worked as expected. You can check the attached example project for reference. Scroll the grid to bottom, click the button and the grid will not scroll.  

Greetings,
Vlad
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
Johnny
Top achievements
Rank 1
answered on 12 Jul 2010, 01:18 PM
Hi,

thanks for the sample this helped solving my problem. I know now how it should work...

Before I bounded a ObservableCollection<MyObject> to the grid and raised the OnPropertyChanged for the bounded collection and than my effect happened. (I think the complete datasource got rebounded by the grid, I thought, it just updates the data).

When I put the OnPropertyChanged in each property of the MyObject like in the sample, it works like it should.

->But I have several grids and e.g. a overview grid with a dozend columns which could change. So its a little bit work.....

Tags
GridView
Asked by
Johnny
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Johnny
Top achievements
Rank 1
Share this question
or