Server side paging sorting example

9 posts, 1 answers
  1. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 21 May 2010 Link to this post

    Can Telerik provide example of Server side paging and sorting without WCF RIA Service using last build of RadControls ?
  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 25 May 2010 Link to this post

    Hello,

    Please find attached modified example with our latest binaries.

    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.
  3. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 26 May 2010 Link to this post

    Thanks Vlad.

    I add three line code to file MyDataContext.cs to make page and sort work as I expected.

        public class MyDataContext
        {
            private int _pageIndex = 0;

            NorthwindServiceSoapClient _Client;
            public NorthwindServiceSoapClient Client
            {
                get
                {
                    if (_Client == null)
                    {
                        _Client = new NorthwindServiceSoapClient();
                    }

                    return _Client;
                }
            }

                        Client.GetCustomersCompleted += (s, args) =>
                        {
                            collection.SuspendNotifications();
                            collection.Clear();
                            collection.AddRange(args.Result.Data);
                            collection.ResumeNotifications();

                            _Data.SetIsLoading(false);

                            _Data.Refresh();

                            _Data.SetTotalItemsCount(args.Result.Count);

                            _Data.MoveToPage(_pageIndex);

                            _Data.CollectionChanged += CollectionChanged;
                        };

            void Refresh()
            {
                _pageIndex = _Data.PageIndex;

                Client.GetCustomersAsync(_Data.PageIndex * _Data.PageSize, _Data.PageSize,
                    _Data.SortDescriptors.ToDynamicLinq(),
                    _Data.FilterDescriptors.ToDynamicLinq(),
                    _Data.GroupDescriptors.ToDynamicLinq());
            }

  4. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 30 May 2010 Link to this post

          public override int TotalItemCount
            {
                get
                {
                    return itemCount;
                }
                protected set
                {
                    //base.TotalItemCount = value;
                }
            }

    I set a breakpoint at TotalItemCount's getter, found it is accessed alomost one hundred times before RadGridView loaded, is that correct?
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 01 Jun 2010 Link to this post

    Hello,

    Since the count is cached there will be no problem to call it multiple times.

    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.
  6. Stephen
    Stephen avatar
    1 posts
    Member since:
    Sep 2012

    Posted 24 Sep 2012 Link to this post

    The latest binaries for Silverlight has broken server side paging/sorting sample.  Can we get an updated version now that the ColumnFilterDescriptor is internal?
    http://www.telerik.com/community/forums/silverlight/gridview/known-issues-and-breaking-changes---radgridview.aspx
  7. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 25 Sep 2012 Link to this post

    Hello,

     Here is an example how to update the code:

            public static string ToDynamicLinq(this IColumnFilterDescriptor source)
            {
                var result = new List<string>();


                foreach (var item in source.DistinctFilter.DistinctValues)
                {
                    result.Add(String.Format("{0} == {1}", source.Column.UniqueName, item.GetType() == typeof(string) ? 
                        String.Format(@"""{0}""", item) : item));
                }


                return String.Join(" || ", result.ToArray());
            }

    Regards,
    Vlad
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  8. Rajat Panwar
    Rajat Panwar avatar
    11 posts
    Member since:
    Aug 2009

    Posted 23 Nov 2012 Link to this post

    Hello

    I am using these two methods to try convert VirtualQueryableCollectionView.FilterDescriptors to dynamic linq
    public static string ToDynamicLinq(this FilterDescriptorCollection source)
            {
                var result = new List<string>();
     
                foreach (var d in source.OfType<IColumnFilterDescriptor>())
                {
                    result.Add(d.ToDynamicLinq());
                }
                 
                return String.Join(" && ", result.ToArray());
            }
     
    public static string ToDynamicLinq(this IColumnFilterDescriptor source)
            {
                var result = new List<string>();
     
                foreach (var item in source.DistinctFilter.DistinctValues)
                {
                    result.Add(String.Format("{0} == {1}", source.Column.UniqueName, item.GetType() == typeof(string) ?
                        String.Format(@"""{0}""", item) : item));
                }
     
                return String.Join(" || ", result.ToArray());
            }

    But it does not seams to work. The problem I could see was that in foreach loop, the descriptor are not of type IColumnFilterDescriptor (Check attached image)

    rather they are of type Filterdescriptor so extension method taking IColumnFilterDescriptor is not called.

    Can you help me achieve filtering. because as of now no matter what filter I apply, ToDynamicLinq() always returns empty string.

    A bit on the background why I need this scenario. We have a plain WCF service which is called by Silverlight application. At some places we need to achieve server side filtering and sorting with the help of raddatafilter.
    If required you can post any other approach to achieve this but constraint is that we need to use plain wcf only.

    Thanks and Regards,
    Rajat Panwar
  9. Rajat Panwar
    Rajat Panwar avatar
    11 posts
    Member since:
    Aug 2009

    Posted 26 Nov 2012 Link to this post

    We need Server side filtering using pain WCF services and RadDataFilter.
    Current examples are outdated and do not work with latest Silverlight libraries from teleik. Above post explains the problem we are facing.

    Thanks and Regards,
    Rajat Panwar
Back to Top