Re: [flexcoders] observing a model change in cairngorm
Could you explain how a little? If I have a Class Foo containing a ArrayCollection of Goo classes and Goo has a ArrayCollection of Hoo classes and I change one of the Hoo instances, my bindings to Foo will not fire. Seems my bindings to one of the Goos will thugh. Its as if the change events are firing up one level only. How to get the top level object to fire change events if its lowliest memeber changes? DK On 2/20/07, Battershall, Jeff [EMAIL PROTECTED] wrote: I've had pretty good luck using mx.binding.utils.ChangeWatcher to map a change event in data to a defined function, thereby allowing me to control the response to the change event. Jeff -Original Message- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Gareth Edwards *Sent:* Sunday, February 18, 2007 4:46 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] observing a model change in cairngorm Typically a binding like the one described will only execute if the actual property changes, and not its children. So, if need be, you can do something like this to make sure the binding executes. model.someData = new ArrayCollection(mysomeDataArray); Many ways to do what you might need, just getting the best solution for you (or maybe best practices?). But I think Flex and some best practices is a little up in the air still. So, find something that works for you and go with it I reckon. An Observer works nicely to. Cheers Gareth. [EMAIL PROTECTED] Grant Davies wrote: Thanks Dimitrios.. Question is when the Model.someData changes, will my set dataProvider function be called again ? During my testing it appeared to be called when it was first run, but when the model changed the setProvider function was never called again... 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]://www.bluetube.com/bti -Original Message- From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com flexcoders@yahoogroups.com] On Behalf Of Dimitrios Gianninas Sent: Sunday, February 18, 2007 11:24 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] observing a model change in cairngorm 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: flexcoders@yahoogroups.com on behalf of Grant Davies Sent: Sat 2/17/2007 5:57 PM To: flexcoders@yahoogroups.com 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]://www.bluetube.com/bti http://www.bluetube.com/bti http://www.bluetube.com/bti A Tribal Chicken Designs Affiliate http://www.tribalchicken.com/ http://www.tribalchicken.com/ From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com flexcoders@yahoogroups.com] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 5:43 PM To: flexcoders@yahoogroups.com 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
RE: [flexcoders] observing a model change in cairngorm
I've had pretty good luck using mx.binding.utils.ChangeWatcher to map a change event in data to a defined function, thereby allowing me to control the response to the change event. Jeff -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gareth Edwards Sent: Sunday, February 18, 2007 4:46 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] observing a model change in cairngorm Typically a binding like the one described will only execute if the actual property changes, and not its children. So, if need be, you can do something like this to make sure the binding executes. model.someData = new ArrayCollection(mysomeDataArray); Many ways to do what you might need, just getting the best solution for you (or maybe best practices?). But I think Flex and some best practices is a little up in the air still. So, find something that works for you and go with it I reckon. An Observer works nicely to. Cheers Gareth. [EMAIL PROTECTED] Grant Davies wrote: Thanks Dimitrios.. Question is when the Model.someData changes, will my set dataProvider function be called again ? During my testing it appeared to be called when it was first run, but when the model changed the setProvider function was never called again... 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 -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dimitrios Gianninas Sent: Sunday, February 18, 2007 11:24 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] observing a model change in cairngorm 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: flexcoders@yahoogroups.com on behalf of Grant Davies Sent: Sat 2/17/2007 5:57 PM To: flexcoders@yahoogroups.com 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
RE: [flexcoders] observing a model change in cairngorm
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: flexcoders@yahoogroups.com on behalf of Grant Davies Sent: Sat 2/17/2007 5:57 PM To: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 5:43 PM To: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 4:32 PM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 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
RE: [flexcoders] observing a model change in cairngorm
Thanks Dimitrios.. Question is when the Model.someData changes, will my set dataProvider function be called again ? During my testing it appeared to be called when it was first run, but when the model changed the setProvider function was never called again... 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 -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dimitrios Gianninas Sent: Sunday, February 18, 2007 11:24 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] observing a model change in cairngorm 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: flexcoders@yahoogroups.com on behalf of Grant Davies Sent: Sat 2/17/2007 5:57 PM To: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 5:43 PM To: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 4:32 PM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 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
RE: [flexcoders] observing a model change in cairngorm
Yes it should assuming that the variable of the entire class has the [Bindable] metadata tag specified. Dimitrios Gianninas Optimal Payments Inc. -Original Message- From: flexcoders@yahoogroups.com on behalf of Grant Davies Sent: Sun 2/18/2007 11:30 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] observing a model change in cairngorm Thanks Dimitrios.. Question is when the Model.someData changes, will my set dataProvider function be called again ? During my testing it appeared to be called when it was first run, but when the model changed the setProvider function was never called again... 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 -Original Message- From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dimitrios Gianninas Sent: Sunday, February 18, 2007 11:24 AM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] observing a model change in cairngorm 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: flexcoders@yahoogroups.com on behalf of Grant Davies Sent: Sat 2/17/2007 5:57 PM To: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 5:43 PM To: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 4:32 PM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 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
RE: [flexcoders] observing a model change in cairngorm
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] http://www.bluetube.com/bti http://www.bluetube.com/bti A Tribal Chicken Designs Affiliate http://www.tribalchicken.com/ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 4:32 PM To: flexcoders@yahoogroups.com 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/ attachment: small.jpg attachment: ATT13003169.jpg
Re: [flexcoders] observing a model change in cairngorm
Hi Grant Can't you use a binding function? dataProvider={ massageData( ModelLocator.getInstance().myData ) } Cheers Ralf. On 2/17/07, Gareth Edwards [EMAIL PROTECTED] wrote: 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) : 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] › http://www.bluetube.com/bti › A Tribal Chicken Designs Affiliate http://www.tribalchicken.com/ -- *From:* flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.comflexcoders@yahoogroups.com] *On Behalf Of *Gareth Edwards *Sent:* Saturday, February 17, 2007 4:32 PM *To:* flexcoders@yahoogroups.com *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) : 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] › http://www.bluetube.com/bti › A Tribal Chicken Designs Affiliate http://www.tribalchicken.com/ -- Ralf Bokelberg [EMAIL PROTECTED] Flex Flash Consultant based in Cologne/Germany Phone +49 (0) 221 530 15 35
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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 5:43 PM To: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 4:32 PM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 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/ attachment: small.jpg attachment: ATT13006568.jpg attachment: ATT13006569.jpg
RE: [flexcoders] observing a model change in cairngorm
I tried that and its only called ONCE as you're binding to a function that manipulates the data. when the data in - ModelLocator.getInstance().myData changes there is nothing bound to it, since you bound to the function massage data and not the actual data in the model... does that make any sense ? 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Ralf Bokelberg Sent: Saturday, February 17, 2007 5:54 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] observing a model change in cairngorm Hi Grant Can't you use a binding function? dataProvider={ massageData( ModelLocator.getInstance().myData ) } Cheers Ralf. On 2/17/07, Gareth Edwards [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: 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) : 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: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [ mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Gareth Edwards Sent: Saturday, February 17, 2007 4:32 PM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 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) : 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/ -- Ralf Bokelberg [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Flex Flash Consultant based