0 Replies Latest reply on Apr 18, 2008 2:06 AM by mcampster

    Binding to a complex data model

      I am trying to one-way bind a custom component to a complex actionscript data model (the complex data model actually represents a c# dataset).

      So, I have an complex object X of custom type datasetstored in my model. I also have a custom component with property Y (also type dataset).

      The problem I am having is that when I bind the property Y of the custom component to the complex object X, the object is passed by reference, not by value. So in fact, it is not creating a 1-way binding but in fact simply pointing property Y at X. So any changes in X are seen in Y and any changes in Y are seen in X.

      This is not what I want. I would like changes in the model, X, to be seen in the view Y, but changes to the view Y not to be seen in the model X, hence the need for one way binding.

      I realise that Flex, by default is one way binding, but usually you are binding value-type items such as strings to labels, not complex objects to complex objects.

      Binding an advanceddatagrid's dataProvider to an arraycollection has exactly the same effect, as an arraycollection is passed around by reference, not by value. So any changes you make in the datagrid are immeidately made to the arraycollection as well.

      Does anyone know of an alternate solution that could get around this problem?