[CLOSED] order by all data , not just order the data on the current page

  1. #1

    [CLOSED] order by all data , not just order the data on the current page

    the default order in gridpanel is just order by current page, how to order by all data?
    below is my code.
                            <ext:Store runat="server" ID="s_domain" PageSize="10" RemoteSort="True" OnReadData="LoadAllDomain"  >
                                    <ext:Model ID="Model1" runat="server" IDProperty="suffix"  Name="m_domain">
                                            <ext:ModelField Name="suffix"></ext:ModelField>
                                            <ext:ModelField Name="reg_price"></ext:ModelField>
                                            <ext:ModelField Name="renew_price"></ext:ModelField>
                                            <ext:ModelField Name="transfer_price"></ext:ModelField>
    set remotesort for server sorting.
    public void LoadAllDomain(object sender, StoreReadDataEventArgs e)
                DataSorter[] sorters = e.Sort; 
                int start = e.Start;
                int limit = e.Limit;
                int total;
                string prop = string.Empty;
                string direct = string.Empty;
                var l = new List<QizDomain>();
                if (sorters.Length > 0)// if user click the the clolumn,pass prop and direct to the server
                    DataSorter dataSorter = sorters[0];
                    prop = dataSorter.Property;
                    direct = dataSorter.Direction == Ext.Net.SortDirection.ASC ? "asc" : "desc";
                    l = _domainService.AllDomains(start, limit, out total, prop, direct);
                else  //if not click the column , no not sort
                    l = _domainService.AllDomains(start, limit, out total);
                e.Total = total;
                s_domain.DataSource = l;
            public List<QizDomain> AllDomains(int start, int limit, out int total)
                total = _ent.QizDomains.Count();
                var dd = _ent.QizDomains.OrderBy(v => v.suffix).Skip(start).Take(limit).ToList();
                return dd;
            public List<QizDomain> AllDomains(int start, int limit, out int total, string prop, string direct)
                total = _ent.QizDomains.Count();  
                var dd = _ent.QizDomains.OrderBy(v => v."prop direct").Skip(start).Take(limit).ToList();// here how to order a dynamic column ?
                return dd;
    i encounter a difficulty do this , could you please help me?
    Last edited by Daniil; Jan 13, 2014 at 3:53 PM. Reason: [CLOSED]
  2. #2
    LINQ supports dynamic expressions
    Please see the following sample

    Click "Source code" button and switch to EntitiesAdditions.cs tab
    See how the sorting is organized
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    thanks.it works now

Similar Threads

  1. [CLOSED] Order GridPanel Groups in an arbitrary order?
    By dmoore in forum 1.x Premium Help
    Replies: 4
    Last Post: Dec 27, 2013, 5:35 AM
  2. Export data to excel - in order columns
    By tanju_yayak in forum 1.x Help
    Replies: 2
    Last Post: Mar 22, 2012, 7:40 AM
  3. Replies: 0
    Last Post: Aug 24, 2011, 1:13 AM
  4. Replies: 13
    Last Post: Aug 11, 2011, 7:11 AM
  5. Replies: 5
    Last Post: Mar 05, 2010, 3:34 PM

Posting Permissions