AdvancedDataGrid Sorting

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default AdvancedDataGrid Sorting

    I'm having a problem getting an AdvancedDataGrid to sort data in the proper
    order. I'm using a GroupingCollection as the dataprovider and I have two
    fields that are being grouped and sorted correctly. However, the children of
    the second grouping (the detail records) are not being sorted correctly. I've
    attempted changing the order in which the data is delivered by the SQL call,
    I've attempted applying a sort function to both the ArrayCollection and
    GroupingCollection, but nothing seems to work. If I make the detail records
    their own group (groupingField), the sort sequence is correct, but the Grid
    does not look very good that way. Has anyone run into this problem? I thought
    that identifying the detail field in the GroupingCollection "childrenField"
    parameter would correct the problem, but it throws an RTE (type coercion
    error). Any advice would be appreciated.

    Thank You,
    M. McConnell

    ANSCORP Guest

  2. Similar Questions and Discussions

    1. Stuck in the AdvancedDatagrid
      Hi All, I want to access the data within the Advanced Datagrid but I cant seem to do it. I have defined some summary data using Grouping...
    2. Question for AdvancedDataGrid?
      Hi, I did a AdvancedDataGrid without grouping,it works fine. <mx:AdvancedDataGri d x="8" y="72" width="558" height="247" rowCount="4"...
    3. AdvancedDataGrid and HierarchicalData
      I'm having a problem with the AdvancedDataGrid and HierachicalData. I have an HTTPService that is getting data from an XML file off the server. I...
    4. AdvancedDataGrid styling help
      Hello, I am trying to style an ADG such that certain horizontal lines in the grid are rendered with larger line thicknesses. I have tried a...
    5. Could not resolve <mx:AdvancedDataGrid>
      hi, all, I don't have much experience on Flex, and I met this problem when I try to open my mxml on Tomcat: Could not resolve...
  3. #2

    Default Re: AdvancedDataGrid Sorting

    To get sorting to work properly you need to apply sorting after supplying
    GroupingCollection as dataProvider to ADG and refreshing it.

    adg.dataProvider = gc;
    gc.refresh();
    adg.dataProvider.sort = new Sort();
    ...set up fields....

    Have you followed these steps? If you have and still it is not working it
    would be of great help if you can post some sample code which shows the problem.

    Sreenivas R Guest

  4. #3

    Default Re: AdvancedDataGrid Sorting

    Yes....I had already tried that method. It did not work for me. I can't
    reveal too much of the code, but here is the Actionscript function that
    receives the database query results and proceeds to populate the
    GroupingCollection and ADG:

    private function getMarginReport_result(event:ResultEvent):void{
    marginReportData = event.result as ArrayCollection;
    this.invDate = new Date(this.marginReportData[0].invoicedate);
    this.weDate = new Date(this.marginReportData[0].weekenddate);
    this.pwDate = new Date(this.marginReportData[0].pwinvoicedate);
    this.marginReportHeader = "Margin Report for Billing Date " +
    formatDate.format(this.invDate) + " for Activity Week Ending " +
    formatDate.format(this.weDate);
    gc.source = marginReportData;
    adg.dataProvider = gc;
    gc.refresh();
    adg.dataProvider.sort = new Sort();
    adg.dataProvider.sort.fields = [new SortField("mr1empclass", true, false),
    new SortField("mr1branchid", true, false)];
    adg.dataProvider.refresh();
    adg.validateNow();
    adg.expandAll();
    }

    "gc" is defined in the MXML. "mr1branchid" is the detail data that appears
    when you expand all the parent nodes. The problem is, when I get the
    "mr1empclass" field to sort correctly, "mr1branchid" gets out of order and when
    I get "mr1branchid" to sort correctly, "mr1empclass" gets out of order. It's
    the craziest thing I've ever seen and I've been working on this problem for a
    week now. Any insight would be appreciated.

    Thank You,
    M. McConnell

    ANSCORP Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139