1 Reply Latest reply on Aug 4, 2010 2:08 PM by Flex harUI

    Databinding that works on Spark List doesn't work on DataGrid?!

    EricJ32 Level 1

      Hi,

       

      This has me completely confused! The application is in Flex 4.

       

      I have a class, called Account, which I am binding to.

       

      Account has a "parent" item called item which in turn has a list of children Accounts, held in an ArrayCollection. This is what I'm binding to.

       

      [Bindable]
      public var account:Account;

       

      ...

       

      <s:List dataProvider="{account.item.accounts}" labelField="accountName" />

       

      <mx:DataGrid id="grid" dataProvider="{account.item.accounts}" />

       

      I've not added columns to the DataGrid for the purposes of this test, so it shows the entire object.

       

      When I first load the component, it populates both the List and DataGrid correctly. However, if the object 'account' changes, only the Spark List updates, the DataGrid simply empties.
      If I add a click handler to the DataGrid and call grid.invalidateList(), it populates.
      If I catch the set function of account, I can inspect that account has been updated, but that grid.dataProvider is null.

       

      So, any idea what gives? Why is automatic binding not working on the DataGrid?

       

      Thanks!