Telerik blogs

I’m happy to announce that with our upcoming service pack (Q3 2010 SP1) you will be able to sort, filter and load records on demand with WCF RIA Services and our VirtualQueryableCollectionView.
image

 

To enable this we’ve added two extension methods for EntityQuery<T> and now you can use directly VirtualQueryableCollectionView SortDescriptors and FilterDescriptors:

var context = new NorthwindDomainContext();
var query = context.GetOrder_DetailsQuery().OrderBy(o => o.OrderID);

var view = new VirtualQueryableCollectionView() { LoadSize = 10, VirtualItemCount = 100 };
view.ItemsLoading += (s, e) =>
{
    var queryToLoad = query
.IncludeTotalCount(true)
.Sort(view.SortDescriptors)
.Where(view.FilterDescriptors)
.Skip(e.StartIndex)
        .Take(e.ItemCount);

    context.Load<Order_Detail>(queryToLoad).Completed += (sender, args) =>
    {
        var lo = (LoadOperation)sender;
        if (lo.TotalEntityCount != -1 && lo.TotalEntityCount != view.VirtualItemCount)
        {
            view.VirtualItemCount = lo.TotalEntityCount;
        }

        view.Load(e.StartIndex, lo.Entities);
    };
};
 

Enjoy!

 


About the Author

Vladimir Enchev

is Director of Engineering, Native Mobile UI & Frameworks

Comments

Comments are disabled in preview mode.