One way to do it is for the ChartView to manipulate the data as it wishes. So have a setter in the ChartView MXML like so:
<bla:ChartView dataProvider="{ModelLocator.someData}"/>
And inside the view it looks like so:
<mx:Box>
<mx:Script>
public function set dataProvider( values:XML ):void {
... do stuff here
}
</mx:Script>
... view stuff here ...
</mx:Box>
Dimitrios Gianninas
Optimal Payments Inc.
-----Original Message-----
From: [email protected] on behalf of Grant Davies
Sent: Sat 2/17/2007 5:57 PM
To: [email protected]
Subject: RE: [flexcoders] observing a model change in cairngorm
gareth,
thanks for the response... I think my concern is poluting the model with
view specific data...
The results of a command is xml and this is set in the model which is an
as class (VisitorModel) , the chart bound to the model via its data
provider.
when the app first starts up, I don't have any xml, a user picks a date
range, I hit a web service and get valid xml back, then the chart has
to has create a column series based on some labels in the xml, so I
need to know when the xml has changed so that the column series can be
created and the chart updated.
In your example below, does the buildJobsTree just manipulate the data
or does it actually do something to the view ?
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 Gareth Edwards
Sent: Saturday, February 17, 2007 5:43 PM
To: [email protected]
Subject: Re: [flexcoders] observing a model change in cairngorm
Why not define an as class for your model (if you aren't already), and
define a separate variable that you can populate on the other data being
set?
The snippet I posted is from something I've done that looks like
this....
public function set jobs (data:ArrayCollection <data:ArrayCollection> )
: void
{
_jobs = data;
buildJobsTree(_jobs);
}
Not sure if its the best option.. but it certainly works for me.
Either that, or there are some observer classes from Adobe Consulting
that allow you to watch changes to your model from the UI.
Cheers
Gareth.
Grant Davies wrote:
Thanks gareth..
the model is used by multiple views, a grid and a chart, the
chart needs the xml from the model manipulated a little differently than
the grid does...
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] <mailto:[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]> [mailto:[email protected]
<mailto:[email protected]> ] On Behalf Of Gareth Edwards
Sent: Saturday, February 17, 2007 4:32 PM
To: [email protected]
<mailto:[email protected]>
Subject: Re: [flexcoders] observing a model change in cairngorm
Why not use a setter in your model and do the work there?
public function set jobs (data:ArrayCollection
<data:ArrayCollection> ) : void
{
// Custom logic here?
_jobs = data;
}
Cheers
Gareth.
Grant Davies wrote:
Hi guys, I've got my view, model, commands and delegate
all running and my view contains a chart.
When the model changes for my chart data I need to work
the data a little and can't just directly use the binding.
do I
1) change my command to fire an event when the model has
been updated
2) Is there some way I can observe a model change and
then kick of my "data work" a little and not directly bind the chart to
the model ?
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] <mailto:[EMAIL PROTECTED]>
> http://www.bluetube.com/bti
<http://www.bluetube.com/bti>
> A Tribal Chicken Designs Affiliate
<http://www.tribalchicken.com/>
--
WARNING
-------
This electronic message and its attachments may contain confidential,
proprietary or legally privileged information, which is solely for the use of
the intended recipient. No privilege or other rights are waived by any
unintended transmission or unauthorized retransmission of this message. If you
are not the intended recipient of this message, or if you have received it in
error, you should immediately stop reading this message and delete it and all
attachments from your system. The reading, distribution, copying or other use
of this message or its attachments by unintended recipients is unauthorized and
may be unlawful. If you have received this e-mail in error, please notify the
sender.
AVIS IMPORTANT
--------------
Ce message électronique et ses pièces jointes peuvent contenir des
renseignements confidentiels, exclusifs ou légalement privilégiés destinés au
seul usage du destinataire visé. L'expéditeur original ne renonce à aucun
privilège ou à aucun autre droit si le présent message a été transmis
involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes
pas le destinataire visé du présent message ou si vous l'avez reçu par erreur,
veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses
pièces jointes, de votre système. La lecture, la distribution, la copie ou
tout autre usage du présent message ou de ses pièces jointes par des personnes
autres que le destinataire visé ne sont pas autorisés et pourraient être
illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en
aviser l'expéditeur.
<<winmail.dat>>

