[CLOSED] Store GroupField and GroupDir - group and order by one field, display another?

  1. #1

    [CLOSED] Store GroupField and GroupDir - group and order by one field, display another?

    Within a store, is there a way to Group and Order by one value, but display another?

    For example, I have this:
    <ext:Store runat="server" GroupField="QuarterDescription" GroupDir="desc">
    But what if I want to display QuarterDescription as my group header while grouping and ordering by the QuarterCode? The reason for this is that when descriptions are sorted in alphabetical order they look like this:
    Autumn
    Spring
    Summer
    Winter

    But I need them in chronological order (which using codes behind the scenes would accomplish):
    Autumn
    Winter
    Spring
    Summer
    Last edited by Daniil; Jul 18, 2013 at 7:27 AM. Reason: [CLOSED]
  2. #2
    Based on a few other posts, I tried some things but no luck.

    I now have this for my group field:
    <ext:ModelField Name="QuarterDescription">
           <CustomSortType Fn="switchQuarterDescToCode " />
    </ext:ModelField>
    and then this in my JavaScript at the top of the page:
    var switchQuarterDescToCode = function (value, record) {
                return record.data["QuarterCode"];
            };
    but there's no difference in the sorting.

    These are the posts I referenced:
    http://forums.ext.net/showthread.php...rbitrary-order
    http://forums.ext.net/showthread.php...custom-sorting
  3. #3
    Hi @zfreeman,

    What about remote grouping? I.e. grouping on server side. Here is an example.
    http://forums.ext.net/showthread.php...l=1#post109465
  4. #4
    This is something I thought about, but in my case, there's not a set group of values that are going to be used (like "Group A", "Group B", etc.). As the years go on, more quarters will be constantly added (and each quarter has a unique quarterID). I could use this style and pull out the year and order by that and then pull out the quarter and order by that, but I decided on a much simpler (and much more hackish) way of handling this.

    I just inserted extra spaces in the descriptions between the year and the quarter... which, oddly enough, serves to change the order but then doesn't affect the display (as the browser doesn't acknowledge the additional spaces). So I just created a new attribute and changed the description this way:

        public string appliedForQuarterFormatted
        {
            get
            {
                string newQuarterDesc = appliedForQuarter;
                if (appliedForQuarter.Contains("Autumn"))
                    newQuarterDesc = appliedForQuarter.Insert(9, "   ");
                if (appliedForQuarter.Contains("Winter"))
                    newQuarterDesc = appliedForQuarter.Insert(9, "  ");
                if (appliedForQuarter.Contains("Spring"))
                    newQuarterDesc = appliedForQuarter.Insert(9, " ");
                if (appliedForQuarter.Contains("Summer"))
                    newQuarterDesc = appliedForQuarter.Insert(9, "");
                return newQuarterDesc;
            }
        }
    You can close this one.
  5. #5
    A solution doesn't look robust... Are you sure it won't break at some point?

    If you have any doubts, please post a full test case to reproduce the initial problem. We would be happy to investigate.

Similar Threads

  1. Replies: 1
    Last Post: Mar 29, 2012, 10:42 PM
  2. Numberic and Date Filter Display Order
    By cwolcott in forum 1.x Help
    Replies: 4
    Last Post: Mar 21, 2012, 12:44 PM
  3. Replies: 3
    Last Post: Feb 21, 2012, 8:13 AM
  4. How to display gridpanel columns with order
    By zhangsir199 in forum 1.x Help
    Replies: 0
    Last Post: Apr 20, 2011, 8:00 AM
  5. [CLOSED] radio group event order
    By alexp in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 25, 2009, 12:32 PM

Posting Permissions