0

Something that works

<s:GridColumn dataField="country.code" headerText="Country Code"/>

Something that doesn't

<mx:AdvancedDataGridColumn dataField="country.code" headerText="Country Code" width="50" />

We have many more grand-child attribute like country.code, and we have to use AdvancedDataGrid. Looking deeper into function set dataField(value:String) of both GridColumn, only Normal Grid supports dot ".".

We don't want to use labelFunction as we have 50+ columns like that... If there the way to extend Advanced Grid Column to support dot ?

Could you please suggest a solution? Thank you

Phung D. An
  • 2,402
  • 1
  • 22
  • 23
  • You could populate your ArrayCollection for the dataProvider with value objects with holds a property for every dataField you use in the ADG. Surly you would have to parse all the data before you use it. – michaPau Mar 22 '13 at 12:14

2 Answers2

2

AdvancedDataGrid is an mx component and thus it's older than the Spark DataGrid. As such the Spark DataGrid simply brings new features (when compared to the old mx DataGrid).

If you want this feature in ADG you have two approaches:

  1. Head over to the Apache Flex JIRA and register an 'improvement' issue. Maybe you'll get lucky and someone will pick this up. But I wouldn't count on it: ADG was outsourced by Adobe (a long while ago) and compared to other components it is a crappy piece of code; you will not easily find someone who's willing to dive in that legacy cesspool.
  2. Take matters into your own hands. Clone the Apache Flex repo; add the desired functionality; submit your patch to the Apache Flex community. If you have your solution ready, they'll be pretty quick to respond.
RIAstar
  • 11,912
  • 20
  • 37
  • Here's a related bug: https://issues.apache.org/jira/browse/FLEX-33248. I mention it here as an example of how I fixed a related issue myself and submitted it to the community. The code is now part of Flex 4.9. – RIAstar Mar 22 '13 at 12:25
  • I don't think the leaders will approve the move from Flex4.6 to Flex4.9 easily....So there is no simple solution, right ? I think I will have to get some work-around myself. Thanks for effort to the community – Phung D. An Mar 22 '13 at 18:48
  • This is exactly the kind of argument you could use to convince the leaders' to make the move. Apache Flex is going to crank a new (minor) version every few months now. Why stick with an old version and not leverage improvements in the new ones? – RIAstar Mar 22 '13 at 19:24
1

We've actually added this support to our Extended version of AdvancedDataGrid. The solution is quite simple really, just extend AdvancedDataGridColumn (there are some other things to worry about like sort, and for us filter, etc, but the idea is something like below:) We've added a bunch of stuff to support built in formats and such, so the code below is just psuedo code for this particular issue, not actual code from our codebase.

public class ExtendedAdvancedDataGridColumn{


            public var enableNestedPropertySupport:Boolean=true;
            public override function itemToLabel(data:Object, withFormatting:Boolean=true):String
            {
                if(enableNestedPropertySupport){ 
                    return  UIUtils.resolveExpression(data,dataField);
                }
                else{
                    return  super.itemToLabel(data, withFormatting);
                }
            }

        }
flexicious.com
  • 1,601
  • 1
  • 13
  • 21