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

Update Count/VirtualItemCount when datasource changes outside the application

3 Answers 124 Views
Data Virtualization
This is a migrated thread and some comments may be shown as answers.
K
Top achievements
Rank 1
K asked on 12 Mar 2018, 10:09 AM

Hey guys,

I have a RadGridView in the UI of my application and bind it to a VirtualQueryableCollectionView shown in the example:
https://docs.telerik.com/devtools/wpf/consuming-data/using-data-virtualization
That works fine so far.

Since I have a client/server architecture, it may happen that the server updates the database table collection is "looking" on.

Let's say there are 41 entries in the table after the UI started. Then the server adds one entry to the database. Afterwards the server notifies the client and the client executes "view.Refresh();".

Due to sorting the new entry may appear in the UI BUT the VirtualItemsCount remains 41.

I cannot find any method that allows me to refresh/update the underlying collection so that the collection is synchronized to the database.

Is it possible to achive this behavior or do I have to recreate the VirtualQueryableCollectionView with "view = new VirtualQueryableCollectionView (query);" on each refresh?

 

I appreciate any feedback :)

3 Answers, 1 is accepted

Sort by
0
K
Top achievements
Rank 1
answered on 12 Mar 2018, 10:11 AM
Edit: I use Version 2018.1.122.45
0
K
Top achievements
Rank 1
answered on 13 Mar 2018, 09:49 AM

I found a workaround for this.

When the server send the notification, I call a Refresh method on the client.

The Refresh method first queries manually the count of items in the database table, then updates the VirtualQueryableCollection.VirtualItemsCount Property to the queried count and finally executes VirtualQueryableCollection's Refresh() method.

 

Found the idea here: https://www.telerik.com/forums/how-to-update-items-in-a-radgridview-with-virtualqueryablecollectionview

I came to this thread before but it seems I did not read it carefully.

0
Dilyan Traykov
Telerik team
answered on 15 Mar 2018, 09:02 AM
Hello,

I'm glad to hear that you've found a solution to your issue and want to thank you for sharing your approach with the community.

Should you come across any other issues or any follow-up questions arise, don't hesitate to contact us again.

Regards,
Dilyan Traykov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Data Virtualization
Asked by
K
Top achievements
Rank 1
Answers by
K
Top achievements
Rank 1
Dilyan Traykov
Telerik team
Share this question
or