0

I am creating tree structure using advanceddatagrid. The dataprovider is grouping collection whose source is arraycollection. This grouping collection is grouping the fields as specified and I am getting the right tree structure.

I have this type of tree structure

Client
      Fund
          Account

Whenever user clicks on any of these node there is click handler which is as follows:

          private function clickhandler(event:Event){

           var item:VO=event.currentTarget.selectedItem as VO
           Alert(item.ID);
          }

Where VO is a bean class whose fields are

  ID
  Name

When I click on Account node I am getting the right alert value(according to above function) but when I click on fund or client I am not getting value in alert. It says error as Type error:#1009 cannot access the property

So here when I click on leaf node I am getting the data source value which are associated to that node but when I am clicking non leaf node I am not getting the data source values like (as in above function VO.ID and VO.Name). How to get it solved?

Second question: Also I want to know that on which level user has clicked in the tree that is level 1(client) or level 2(fund) or level 3(account).

ryan
  • 333
  • 1
  • 15
  • 28

1 Answers1

0

Try to create your own AdvancedDataGridGroupItemRenderer and AdvancedDataGridItemRenderer

<mx:AdvancedDataGrid 
itemRenderer="MyAdvancedDataGridItemRenderer"
groupItemRenderer="MyAdvancedDataGridGroupItemRenderer">
</mx:AdvancedDataGrid>

In classes MyAdvancedDataGridItemRenderer and MyAdvancedDataGridGroupItemRenderer create click handlers in this handlers set breakpoints and debug. I think it helps you understand nodes

Anton
  • 305
  • 3
  • 6