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

Asnyc data and loading too soon.

3 Answers 60 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jay
Top achievements
Rank 1
Jay asked on 24 Oct 2012, 10:26 PM
What I have is a grid of data where the data is loaded using a WCF service.  So its async.  When it gets those results it parses them and for each result fires off another async data request that populates a chartview in each row of the grid.  So if I have 10 items, then there are 11 aysnc data requests through a service.  A lot, but I think necessary to render all the appropriate data. Async, inside an Async.

I am using a View Model as well.

The problem is that it renders the grid before all the data has been retrieved for the inner async calls on the grids so I get the default "No data to plot" message, but just scrolling the chart so the row is off the screen then back again and the chart renders appropriately.  I am sure this is some timing issue and I am using the OnPropertyChanged Method inside the async end of the chart data, but I think its loading anyways and not rendering after all data has been retrieved.

How can I tell the grid to refresh, load, OnPropertyChanged, from inside the EndExecute and be sure to fire after the last async call has been made? This could be 1 - infinite service calls.

3 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 25 Oct 2012, 06:26 AM
Hi,

 You can call Reset collection change for your collection or Rebind() for the grid. 

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jay
Top achievements
Rank 1
answered on 25 Oct 2012, 01:11 PM
I had to expose my RadGridView to the ViewModel to get it to Rebind in the data load.  Not exactly how I'd like as UI is in the VM, but it works.  Is there a way to accomplish this without having to put a UI element in the view model?
0
Vlad
Telerik team
answered on 25 Oct 2012, 02:43 PM
Hi,

 As I said in my previous reply you can raise CollectionChanged event with Reset action to achieve your goal. 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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