6 Replies Latest reply on Jul 19, 2007 9:02 AM by rbetieh

    AdvancedDataGridColumn vs AdvancedDataGridColumnGroup

    rbetieh
      Hi,

      This is my first post here so forgive me if this question has been beat to death.

      Ive noticed that the AdvancedDataGridColumnGroup can be used to hold data much like the AdvancedDataGridColumn. This proved to be rather usefull because I can programmatically traverse ColumnGroups rather easily. In a mixed environment, such traversals end in a "You cant cast this that way" crash. The only drawback is that AdvancedColumnGroup does not have the multiple column sort feature that AdvancedDataGridColumn has. Is there an intention to allow the Groups to have the control-click sort feature as well? If not is there an easy way to program in that functionality using the AdvancedColumnGroup functionality?

      Thanks

      Santiago
        • 1. Re: AdvancedDataGridColumn vs AdvancedDataGridColumnGroup
          rbetieh Level 1
          Ok, I think a small code sample is in order. Here is the background information. I have an AdvancedDataGrid named Data, it is comprised of a group of AdvancedDataGridColumnGroups. Most of these are single-column entities where the group and the column are the same object (by giving the group a dataprovider) others hold multiple columns. I did this so I can correctly

          I want to search for a column by name and make visible that column.


          for(x = 0; x<mainApp.InductionData.groupedColumns.length; x++)
          {
          column = AdvancedDataGridColumnGroup(Data.groupedColumns[x]);
          if(column.headerText == String(columnpicker.selectedItem))
          {
          column.visible = true;
          if(column.children.length > 1)
          {
          for(y = 0; y < column.children.length; y++)
          { childcolumn = AdvancedDataGridColumn(column.children[y]); childcolumn.visible = true;
          }
          ...



          • 2. Re: AdvancedDataGridColumn vs AdvancedDataGridColumnGroup
            rbetieh Level 1
            Hah, I played with this some more, and its not that the ctrl-click feature is not enabled, its that the Up/Down Arrow and the sort number are not displayed.
            • 3. Re: AdvancedDataGridColumn vs AdvancedDataGridColumnGroup
              nisheetjain
              Sorting on a AdvancedDataGridColumnGroup is not supported. It is restricted to the lowest level columns only.

              @rbetieh - AdvancedDataGridColumnGroup extends AdvancedDataGridColumn and it only adds 2 properties to it (children, childrenDragEnabled). Thus while traversing you need not cast it to AdvancedDataGridColumnGroup. If there is something which you need to do in case it is a AdvancedDataGridColumnGroup you can write like this:

              if ( c is AdvancedDataGridColumnGroup)
              doSomething(AdvancedDataGridColumnGroup(c));
              • 4. Re: AdvancedDataGridColumn vs AdvancedDataGridColumnGroup
                nisheetjain Level 1
                I may be wrong here but just want to add that groupedColumns need to have everything as AdvancedDataGridColumnGroup, it can contain AdvancedDataGridColumn also. Thus a declaration like:

                <mx:groupedColumns>
                <AdvancedDataGridColumn dataField="field1"/>
                <AdvancedDataGridColumnGroup headerText="grp">
                <AdvancedDataGridColumn dataField="field2"/>
                <AdvancedDataGridColumn dataField="field3"/>
                </mx:AdvancedDataGridColumn>
                </mx:groupedColumns>

                is perfectly valid
                • 5. Re: AdvancedDataGridColumn vs AdvancedDataGridColumnGroup
                  rbetieh Level 1
                  I can assure you that in the situation where an AdvancedDataColumnGroup is used as an AdvancedDataColumn (i.e. assign it a dataprovider and place no advanceddatacolumns in it) it CAN sort and it DOES support multiple sort features. What it does not do is provide the up/down or number graphics so that you can see that it is doing this.

                  Try this :

                  <mx:groupedColumns>
                  <AdvancedDataGridColumn dataField="field1"/>
                  <AdvancedDataGridColumnGroup headerText="grp" datafiel="field4"/>
                  <AdvancedDataGridColumn dataField="field2"/>
                  <AdvancedDataGridColumn dataField="field3"/>
                  </mx:groupedColumns>

                  Then try the control click feature clicking on the Group first and then on any other column and you will see that I am right on this.

                  I personally like this feature because it simplifies my code and allows me to make the assumption that all my columns are columngroups. I just wish in that situation the graphics showed up. But try it out, its neat.
                  • 6. Re: AdvancedDataGridColumn vs AdvancedDataGridColumnGroup
                    rbetieh Level 1
                    Mind you this applies ONLY if you use a columngroup as a column, which is perfectly valid