Hi there!
I''m trying to bind some data from my Rails application inside a Flex
Datagrid, and i''m just wondering why this code don''t work!
flex Code:
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.Fault;
import mx.rpc.AsyncToken;
import mx.rpc.remoting.RemoteObject;
private function load(e:Event):void{
var ro:RemoteObject = new RemoteObject();
ro.source="StoreController";
ro.destination = "rubyamf";
ro.retrieveProducts();
ro.addEventListener(ResultEvent.RESULT,onResult);
ro.addEventListener(FaultEvent.FAULT,onFault);
}
private function onFault(e:FaultEvent):void
{
resultTxt.text = e.fault.faultString;
}
private function onResult(event:ResultEvent):void
{
dg.dataProvider = event.result
}
]]>
</mx:Script>
<mx:DataGrid id="dg" width="600"
height="400">
<mx:columns>
<mx:DataGridColumn dataField="id"/>
</mx:columns>
</mx:DataGrid>
<mx:Panel width="600" height="400" x="610"
id="productPanel"
title="Prodotti">
<mx:Label id="resultTxt" />
<mx:Button label="Align" click="load(event)" />
</mx:Panel>
StoreController Code
def retrieveProducts
respond_to do |format|
format html
format.amf {render :amf => Product.find(:all) }
format.xml {render :xml => Product.find(:all) }
end
end
from the console i see that the application retrieve the data, but the
Datagrid remains empty! :-(
some word on this?
thanks a lot in advance!
enzo rivello
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---