Ok.  Now I get it.  Thanks Steven, Allen, and Alex.  I was missing the
binding that Alex pointed out and was not entirely clear on the data binding
which is coming into focus.  (looking at individual entries in the book and
missed the chapter headings <bashful grin>).  So what ends up happening is
that we can avoid firing a change event and that overhead by putting the
shopping cart into an object.  As the object changes it causes the
dataProvider binding to be updated automagically.  Very slick.  I guess I
need to read chapters 15 - 18 closely and play with them.  Some of this
stuff is great on paper but doesn't sink in until you are actually trying to
do this sort of manipulation.  

   Thanks Again,

        -Kent

-----Original Message-----
From: Alex Uhlmann [mailto:[EMAIL PROTECTED] On Behalf Of Alex
Uhlmann
Sent: Monday, June 20, 2005 9:16 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Cairngorm Store missing link?

Hi Kent,

we decided to make 5 components of Cairngormstore more modular and
abstracted the ModelLocator. The ShoppingCart.mxml component was one of
those components. If you look into Main.mxml you'll see the inisialisation
of ShoppingCart.mxml

<cart:ShoppingCart id="shoppingCartComp" width="100%" height="100%"
        shoppingCart="{ModelLocator.shoppingCart}"
        selectedItem="{ModelLocator.selectedItem}"
        select="ModelLocator.selectedItem = event.target.selectedItem"
        currencyFormatter="{ModelLocator.currencyFormatter}" />

ShoppingCart.mxml accepts a shoppingCart instance of type
org.nevis.cairngorm.samples.store.business.ShoppingCart. In our case this
comes from ModelLocator. The dataProvider property of the DataGrid in
ShoppingCart.mxml is bound to the elements property of
org.nevis.cairngorm.samples.store.business.ShoppingCart. This ShoppingCart
class is also in the as2docs. Basically, the elements property is a
collection of ShoppingCartElement objects that represent one element. The
ShoppingCart class itself represents all elements and some additional
connected information concerning all elements like the totalProductPrice or
shippingCost.

hope that helps,
Alex   

--
Alex Uhlmann
Software Engineer
iteration::two


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
Behalf Of Kent Henneuse
Sent: 20 June 2005 16:35
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Cairngorm Store missing link?


Ok it is a missing link in my brain and not a link that is missing.

I am confused how the dataProvider on line 58 of ShoppingCart.mxml gets
linked to the one in the ModelLocator?  It appears as if everything is done
by manipulating the ShoppingCart object that is in the ModelLocator and some
how it is getting changed in the View.

I ask because I currently have an Array of objects that represent lines in a
DataGrid.  When I add an element to that array I am not seeing it in the
datagrid.  I figure that it has something to do with the redrawing of the
component.  I looked at the Cairngorm Store as an example because it is very
similar to what I am trying.

  Anxiously awaiting the next Blog installments on the Cairngorm store,

        -Kent

"Black holes are where God divided by zero."
    - Steven Wright

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to