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

Reply via email to