This does sound weird.  I haven't had time to play with the
HTTPService 1s timing issue.  But definetly something is going on.  So
we have narrowed it down to HTTPService and Binding is that correct,
not Cairngorm or other RPC services?

Renaun

--- In [email protected], "Peter Blazejewicz"
<[EMAIL PROTECTED]> wrote:
>
> Hello Jonathan,
> 
> you've posted nice example so I've decided to investigate what you
> described even if i'm not very experienced dev yet,
> 
> so first I wrote a simple jsp page that simply returns xml data (your
> dummy.xml is a content returned) with added Thread.sleep(....) used to
> sustain results for few seconds, Even if I changed response time to
> minimal values there was no change in dashboard behavior, charts are
> not updated with remote call, DataGrid data are correctly updated,
> 
> That was strange for me because I've already ported Flex Dashboard
> sample to Cairngorm and it works fine when data is requested from
server,
> So I next moved HTTPService and onResults/onFault handlers to
> Application that way:
> <code>
> .....
>       initialize="initApp()">
>       <mx:HTTPService showBusyCursor="true" 
>               id="GetSalesData"
url="http://localhost:8084/dashboard/cfm/sales.jsp";   
>               result="onResult(event)"
>               fault="onFault(event)"/> 
>       <mx:Script>
>               <![CDATA[
>                       import mx.rpc.events.*;
>                       import mx.collections.*;
>                       import mx.core.Container;
>                       import mx.controls.*;
>                       import org.healthgrades.tools.*;
>                       import org.healthgrades.stats.model.ModelLocator;       
>                       import org.healthgrades.stats.control.StatsEvent;
>                       
>                       [Bindable]
>                       public var model : ModelLocator = 
> ModelLocator.getInstance();   
>                       
>                       // Starts the 30 second timer and dispatches the 
> EVENT_REFRESH
>                       public function initApp():void {
>                               var date:Date = new Date();
>                               model.viewingDate = date;
>                               // Need to offset the date by an hour for MTN 
> time
>                               model.refreshTime = new Date(date.getFullYear(),
>                                       
date.getMonth(),date.getDate(),date.getHours()-1,date.getMinutes(),
>                                               
> date.getSeconds(),date.getMilliseconds());
>                               model.timer = new Timer(30000);
>                           model.timer.addEventListener("timer", callService);
>                           model.timer.start();
>                               var seed:String = (new 
> Date().getTime().toString());
>                               GetSalesData.send({date:"01/05/2006", 
> rand:seed});
>                       }
>                       // Need to figure a way to bind a DataFormatter to a 
> labelFunction
> directly to get rid of this
>                       private function formatDate(date:Date):String {
>                           return dateShortFormat.format(date);
>                       } 
>                       // Called by the manual refresh button or the timer
>                       private function callService(e:Event):void {
>                               model.viewingDate = theDate2.selectedDate;
>                               var date:Date = new Date();
>                               // Need to offset the date by an hour for MTN 
> time
>                               model.refreshTime = new Date(date.getFullYear(),
>                                       
date.getMonth(),date.getDate(),date.getHours()-1,date.getMinutes(),
>                                               
> date.getSeconds(),date.getMilliseconds());
>                               var seed:String = (new 
> Date().getTime().toString());
>                               GetSalesData.send({date:"01/05/2006", 
> rand:seed});
>                       }
>                  public function onResult( event : ResultEvent ) : void{
>                       var model : ModelLocator = ModelLocator.getInstance();
>                               // Set the data for the charts
>                       model.hourData = new 
> ArrayCollection(event.result.list.hour);
>                               model.dailyData = new ArrayCollection(
> event.result.list.dailydata.value);
>                               model.hourlyData = new ArrayCollection(
> event.result.list.hourlydata.value);
>                               model.racesData = new ArrayCollection(
event.result.list.race.value);
>                               model.theTotal = new
> ArrayCollection(event.result.list.totals.amount);                             
>                               var myDateFunc : DateFunction = new 
> DateFunction();
>                               // Using the dateAdd function to get the dates 
> for the last 4 weeks.
>                               var dateBack:Array = new Array(5);
>                               dateBack[0] = "Current"; 
>                               dateBack[1] = 
> myDateFunc.dateAdd('d',model.viewingDate,7*-1);
>                               dateBack[2] = 
> myDateFunc.dateAdd('d',model.viewingDate,7*-2);
>                               dateBack[3] = 
> myDateFunc.dateAdd('d',model.viewingDate,7*-3);
>                               dateBack[4] = 
> myDateFunc.dateAdd('d',model.viewingDate,7*-4);
>                               model.theDate = new ArrayCollection(dateBack);
>                               model.theDate.refresh();
>                  }
>                  // if the refresh fails, stop the timer
>                  public function onFault( event : FaultEvent ) : void{
>                               var model : ModelLocator = 
> ModelLocator.getInstance();
>                       model.statusMessage = "Refresh error: Please try again 
> later.";
>                       model.timer.stop();
>                       Alert.show(model.statusMessage,"Error",Alert.OK);       
>         
>                  }                    
>               ]]>
>       </mx:Script>
>       <!--    
>       <business:Services id="statsServices" />
>       -->
> ....
> 
> that is moving business logic into main code and there is no change,
> DataGrids data are updated but charts are not,
> with that solution I'm not using Cairngorm for data requests at all
> using basic HTTPService solution,
> I think there is rather something in bindings and Charts with that
> specific solution because as I mentioned I've already existing
> Cairngorm based sample which updates bindings without problems,
> Also Renaun mentioned bindings working fine with AMFPHP based
> Cairngorm implemenation,
> 
> hth,
> kind regards,
> Peter Blazejewicz
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to