A few months ago, I created a component called NestedDataGrid, to address the annoying issue with DataGrids not being able to support nested properties within objects.  This component allows a DataGridColumn’s dataField property to contain a property chain such as:  “object.property.propertyList[2]“.  This is something that wasn’t possible with a default DataGrid.  However, being busy with school (just got my master’s degree in April!  wahoo!) and work, I didn’t have time to build in support for XML-based dataProviders.  After a few requests, I decided to change that and update the NestedDataGrid to support XML.

NestedDataGrid

As of today, the NestedDataGrid can display and sort complex Nested XML dataFields such as:  “xml.node.nodeList[3].@attribute”.  I hope that this update helps ease the frustration of having to flatten XML trees, define custom label functions and/or sort functions, or create custom item renderers to get around this issue.

See the demo and get the source here (Right click to View and Download Source).

Tags: ,

7 Responses


  1. [...] Another reason to use NestedDataGrid is that I also add support for using brackets instead of just the dot syntax, which allows you to access properties inside of an Array or ArrayCollection, or using properties on an object at runtime (i.e. object[property]).  You can also do as many nested levels as you want (i.e. dataField=”object.object1.object2.arrayCollection[0].property1…).  It also works great for XML-based data providers as of my latest update. [...]

  2. Felix on 27 Sep 2009

    Great component you have done. But somehow when the grid is editable, after clicking the cell it will cause an error. Do you have any idea to resolve this issue?

  3. Sebastian on 27 Oct 2009

    A very nice component, thanks for sharing it.
    I have been trying to make a NestedAdvancedDataGrid version of your component but I am having some trouble, I get some errors with the lastSortIndex and sortIndex properties, e.g:

    1178: Attempted access of inaccessible property lastSortIndex through a reference with static type nross:NestedAdvancedDataGrid. NestedAdvancedDataGrid.as

    Have you made the Advanced version?

  4. Vincent on 04 Dec 2009

    First : great job !

    Do the NestedDataGrid works with Flex 3.4 sdk ?
    Because I have made an example with your component and I have this error :


    ArgumentError: Error #1063: Non-correspondance du nombre d'arguments sur mx.controls.dataGridClasses::DataGridColumn/complexColumnSortCompare(). 2 prévu(s), 3 détecté(s).
    at ()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\collections\Sort.as:685]
    at Array$/_sort()
    at Array/http://adobe.com/AS3/2006/builtin::sort()
    at mx.collections::Sort/sort()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\collections\Sort.as:702]
    at mx.collections::ListCollectionView/internalRefresh()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:1312]
    at mx.collections::ListCollectionView/refresh()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:402]
    at nross::NestedDataGrid/sortByColumn()[H:\Wokspace Eclipse\FlexBirt3\TestFlex\src\nross\NestedDataGrid.as:148]
    at nross::NestedDataGrid/onHeaderRelease()[H:\Wokspace Eclipse\FlexBirt3\TestFlex\src\nross\NestedDataGrid.as:109]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:9408]
    at mx.controls.dataGridClasses::DataGridHeader/mouseUpHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridHeader.as:1277]

    In english, it says that the function complexColumnSortCompare needs 2 parameters but there are 3.

    How can we fix this bug ?

  5. john on 31 Dec 2009

    Thank you! But suppose you want to concatenate all of the Parameter values? In your Parameters[2] you have two parameter values but show only one. How could you have

    parameter1, parameter2

    first
    second
    third

    first, second, third

    Any help would be appreciated. Have you tried this with Flex 4?
    <

  6. Nate on 21 Jan 2010

    @Sebastian,

    I tried to make an AdvancedNestedDataGrid, but ran into the same problem you found. The issue is that Adobe made the lastSortIndex and sortIndex properties private. For the NestedDataGrid, they were protected so I could use them. I tried a couple different things (although I didn’t spend a whole lot of time on it) and wound up calling it quits.

    That is the frustrating part about having private variables/methods in the Flex framework.

  7. Nate on 21 Jan 2010

    @Vincent

    There was an issue that was introduced in Flex 3.4. I fixed the issue and uploaded a new version to my site. Let me know if that helps you.


Leave your comment


ray ban wayfarer ebay ray ban aviators
bag borrow or steal
Buy shoes online india
replica handbags