This is a migrated thread and some comments may be shown as answers.
VirtualQueryableCollectionView - Refresh not working when VirtualItemCount == 0
3 Answers 86 Views
This is a migrated thread and some comments may be shown as answers.
Rafal
Top achievements
Rank 1
Rafal asked on 15 May 2012, 09:42 AM
Hi, I use VirtualQueryableCollectionView with RadGridView and RIA Services. As ItemSource for RadGridView I used the following code:
public VirtualQueryableCollectionView VirtualEventsList
        {
            get
            {
                if (_VirtualEventsList == null)
                {
                    _VirtualEventsList = new VirtualQueryableCollectionView() { LoadSize = 50, VirtualItemCount = 1 };
 
                    _VirtualEventsList.FilterDescriptors.Clear();
                    _VirtualEventsList.FilterDescriptors.Add(_QuickSearchFilterDescriptor);
 
                    _VirtualEventsList.ItemsLoading += (s, e) =>
                    {
                        EventListIsBusy = true;
                        var query = Context.GetEventsQuery(GetSelectedPositions());
 
                        var queryToLoad = query
                            .IncludeTotalCount(true)
                            .Sort(_VirtualEventsList.SortDescriptors)
                            .Where(_VirtualEventsList.FilterDescriptors)
                            .Skip(e.StartIndex)
                            .Take(e.ItemCount);
 
                        Context.Load<Event>(queryToLoad).Completed += (sender, args) =>
                        {
                            var lo = (LoadOperation)sender;
                            if (lo.TotalEntityCount != -1 && lo.TotalEntityCount != _VirtualEventsList.VirtualItemCount)
                            {
                                _VirtualEventsList.VirtualItemCount = lo.TotalEntityCount;
                            }
 
                            _VirtualEventsList.Load(e.StartIndex, lo.Entities);
                            EventListIsBusy = false;
                        };
                    };
 
                }
                return _VirtualEventsList;
            }           
        }

When I set QuickSearchFilterDescriptor.Value  then VirtualEventsList.Refresh()works fine. But when collection is filtered and  VirtualEventsList.VirtualItemCount == 0 then VirtualEventsList.Refresh()is not working. This problem I resolved this way when I set QuickSearchFilterDescriptor.Value:
if (_VirtualEventsList.VirtualItemCount == 0)
 {
   _VirtualEventsList.VirtualItemCount = 1;
 }
_EventCategoryFilterDescriptor.Value = FilteringValue;

The problem is when I use the filter on Column in RadGridView. When collection returns 0 records and I change filter value, then Refresh is not working. Do you have any clues?

3 Answers, 1 is accepted

Sort by
0
ATeam
Top achievements
Rank 1
answered on 24 May 2012, 07:41 AM
Hello,

we also have the same Problem.

We are using the VQCV with pure WCF Services, but when a Filter is active which causes the ItemsSource to return 0 rows - then no Refresh will trigger. (Which means that no ItemsLoading Event will be fired and we will never reload data!)

The behavior is alos strange because, when we clear the FieldFilter or DistinctFilter on the column (in the GUI or Code) no refresh will be triggered (The Filter Descriptor Collection on VQCV is empty but that doesnt solve the issue).

Also a recreate of the VQCV an Binding to the Itemssource of the RadGridView doesnt help - same issue.

If a user comes to the above described state,he will never get any Data until he closes the application. Currently I have no idea how to solve this Issue! Please help Telerik!

Kind Regards,
0
Dimitrina
Telerik team
answered on 24 May 2012, 02:18 PM
Hi,

 In our online example setting the VirtualItemsCount initially to "some" value is the way you can deal with the fact at a time the real count is not yet available. 

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
ATeam
Top achievements
Rank 1
answered on 24 May 2012, 05:10 PM
Hi Didie,

thanks for your quick response, but your solution didn't work in my scenario!

I've also had set the VirtualItemCount property on initialization of the VQCV to the value: of the initial PageSize. After getting a response from the web server i have set the VirtualItemCount to the "real" count value for this query.

Have you another suggestion for solving this issue?

Kind regards!
Asked by
Rafal
Top achievements
Rank 1
Answers by
ATeam
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or