Personally instead of directly binding to the Array collection inside
the model for your data grid, I'd register the parent the grid belongs
to to the event that will fire based on a change in the model and inside
that event I'd populate your data grid with the contents of the model
and scroll it to the top.
 
I think binding data directly to your models has some advantages but it
also has some pitfalls when you want to do more than just bind to data,
its also hell to debug. Jesse Warden has a good example of binding in
the trenches - > 
http://www.jessewarden.com/archives/2006/07/binding_in_the.html
 
Grant.
 
 
 
...........................................
> b l u e t u b e i n t e r a c t i v e.
.: grant davies
.: 404.428.6839 (c)
.: 708-983-1577 (F)
> [EMAIL PROTECTED]
> http://www.bluetube.com/bti <http://www.bluetube.com/bti> 
> A Tribal Chicken Designs Affiliate <http://www.tribalchicken.com/> 

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of leds usop
Sent: Thursday, January 11, 2007 3:34 AM
To: [email protected]
Subject: Re: [flexcoders] Need advice on which Event I should be using -



you can do away with the conventional [bindable]
metatag for binding your dataprovider and use
getter-setter instead with a custom flexevent
triggered everytime the setter is called.

or just use the valuecommit event. just make sure you
dont include another value-commit-triggering action
(such as setting another data provider) in the
listener. 

--- Mike Anderson <[EMAIL PROTECTED] <mailto:mike%40anderson.net> >
wrote:

> Hello All,
> 
> I have a Cairngorm application containing a
> DataGrid, in which the
> Grid's dataProvider is bound to an ArrayCollection
> (comprised of
> ValueObjects) located in the ApplicationModel.
> 
> Whenever I want to add a new record to the
> dataProvider, I first create
> a new ValueObject instance, then populate it using a
> Details Form. Of
> course, being a Cairngorm-based app, I dispatch a
> Cairngorm Event
> containing the ValueObject (which causes it to be
> sent off to the
> server), and then wait for the "onResult" response
> from the server.
> 
> Obviously, I can't go blindly adding the new Record
> to the dataProvider,
> until I know for sure that I get a valid "onResult"
> response from the
> server.
> 
> Now assuming that I DO get my "onResult" event, what
> I do then is add
> the ValueObject to the model's ArrayCollection using
> the addItemAt()
> method, inserting the ValueObject at Index Zero so
> it gets pushed to the
> top. This way, all newly created records appear at
> the top of the
> DataGrid (which is exactly what I want to happen).
> 
> This is where things get fuzzy...
> 
> Which Event should I have the DataGrid listen to, so
> that it gets
> scrolled to the very top, *ONLY* when a new record
> gets added to it's
> dataProvider?
> 
> This is a case, where I'd actually prefer
> dispatching a Custom Event, so
> that I can manually dispatch it from the same
> Cairngorm Command Class
> handling the onResult Event - but I don't know if
> that is possible. I
> don't know yet, if I can dispatch events which get
> broadcasted across
> multiple controls. This is where I have a lot to
> learn, regarding the
> Event Model...
> 
> If any of you could help me with this, I'd be very
> grateful for your
> help.
> 
> Thanks in advance for everything,
> 
> Mike
> 
> 

__________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com


 

<<attachment: small.jpg>>

Reply via email to