Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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);
                }
            }

        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top