3 Replies Latest reply on Jun 9, 2006 7:57 AM by ur_dtrain

    Grouping in DataGrid

    mikiM Level 1
      Is it possible?
      Similar approach as <cfquery group=".."
      and then display the group by across the datagrid display and all the items for that group in their respective columns


      Thanks
        • 1. Re: Grouping in DataGrid
          ur_dtrain Level 1
          I'd probably approach this as nested DataGrids, or more simply as a List containing DataGrids, one group per list item.
          • 2. Re: Grouping in DataGrid
            mikiM Level 1
            Thanks,

            do you have a short ex. Even pseudo-code wil do it

            Thx again
            • 3. Re: Grouping in DataGrid
              ur_dtrain Level 1
              In your main application file you'd have something like:

              <mx:List dataProvider="{myGroupData}" labeField="groupName" listItemRenderer="{myGroups}" />

              in an external file called myGroups.mxml you'd have something like this:

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml">
              <mx:Script>
              <![CDATA[
              import mx.core.Application;
              private function getGroupData(groupID:Number):ArrayCollection{
              //poll your data retrieve individual group information
              return groupData;
              }
              ]]>
              </mx:Script>
              <mx:Label text="{data.groupName}" />
              <mx:DataGrid dataProvider="{getGroupData(data.groupID)}" />
              </mx:Canvas>

              This of course makes a lot of assumptions about your data model, but it will generate a new header and grid for each group item. how you go about capturing this and writing your filter function is up to you.