Your results are not in XML.  Maybe you need to specify
resultFormat="e4x"?

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of its_llpj
Sent: Monday, September 10, 2007 9:06 AM
To: [email protected]
Subject: [flexcoders] Re: Populating XMLListCollection and sending it to
a Datagrid

 

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at
c100/onResult()[/Users/pjb54/src/berkleycenter_development/public/bin/c1
00.mxml:52]
at
c100/__orgProgramRequest_result()[/Users/pjb54/src/berkleycenter_develop
ment/public/bin/c100.mxml:98]
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
at flash.events::EventDispatcher/dispatchEvent()
at
mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal
::dispatchRpcEvent
<http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent>
()[C:\dev\enterprise_bali\frameworks\mx\rpc\http\mxml\HTTPService.as:247
]
at
mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resu
ltHandler <http://www.adobe.com/2006/flex/mx/internal::resultHandler>
()[C:\dev\enterprise_bali\frameworks\mx\rpc\AbstractInvoker.as:168]
at
mx.rpc::Responder/result()[C:\dev\enterprise_bali\frameworks\mx\rpc\Resp
onder.as:48]
at
mx.rpc::AsyncRequest/acknowledge()[C:\dev\enterprise_bali\frameworks\mx\
rpc\AsyncRequest.as:82]
at
DirectHTTPChannel.as$139::DirectHTTPMessageResponder/completeHandler()[C
:\dev\enterprise_bali\frameworks\mx\messaging\channels\DirectHTTPChannel
.as:359]
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()

Line 52 is:
trace(xmlResult.toXMLString());

Line 98 is part of the HTTPService:
<mx:HTTPService id="orgProgramRequest" 
url="http://localhost:3000/organizations/flex_programs
<http://localhost:3000/organizations/flex_programs> "
showBusyCursor="true"
result="onResult(event)"
fault="onFault(event)"
method="POST"
useProxy="false"/>

Thanks!

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> What is the full stack trace?
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>
[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of its_llpj
> Sent: Monday, September 10, 2007 8:35 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: Populating XMLListCollection and sending it
to
> a Datagrid
> 
> 
> 
> Oops spoke too soon. I'm getting a TypeError: Error #1009: Cannot
> access a property or method of a null object reference when I click on
> the datagrid to send the ID. The code hasn't changed since the example
> below, but I'm not sure how to troubleshoot this one.
> 
> public function onSelectFirstGrid(event:Event):void
> 
> {
> 
> orgProgramRequest.addEventListener(Event.COMPLETE, onResult)
> 
> //var params:Object = new Object(); 
> //params['id'] = dgOrg.selectedItem.orgID; 
> orgProgramRequest.send(dgOrg.selectedItem.orgID);
> 
> }
> 
> 
> public function onResult(e:ResultEvent):void
> 
> {
> 
> var xmlResult:XML = e.result as XML;
> 
> trace(xmlResult.toXMLString()); //is that the xml you expected?
> 
> var xlResult:XMLList = xmlResult.children(); //or other expression
> 
> trace(xlResult.length()); //is that the right expression?
> 
> dg2data = new XMLListCollection(xlResult)
> 
> trace(dg2data.getItemAt(0).toXMLString());
> 
> }
> 
> [Bindable]
> public var dg2data: XMLListCollection;
> 
> --- In [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> , "its_llpj" <its_llpj@> wrote:
> >
> > That's it! 
> > 
> > Thanks Tracy! Thanks everyone!
> > 
> > 
> > --- In [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> , "Tracy Spratt" <tspratt@>
wrote:
> > >
> > > Ah, yes of course, it almost certainly is. 
> > > 
> > > 
> > > 
> > > I suggest, in verbose style:
> > > 
> > > var xmlResult:XML = e.result as XML;
> > > 
> > > trace(xmlResult.toXMLString()); //is that the xml you expected?
> > > 
> > > var xlResult:XMLList = xmlResult.children(); //or other expression
> > > 
> > > trace(xlResult.length()); //is that the right expression?
> > > 
> > > dg2data = new XMLListCollection(xlResult)
> > > 
> > > trace(dg2data.getItemAt(0).toXMLString()); //to make It easy to
know
> > > the dataField
> > > 
> > > 
> > > 
> > > Tracy
> > > 
> > > 
> > > 
> > > ________________________________
> > > 
> > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > > Behalf Of Alex Harui
> > > Sent: Thursday, September 06, 2007 2:03 PM
> > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> 
> > > Subject: RE: [flexcoders] Populating XMLListCollection and sending
> it to
> > > a Datagrid
> > > 
> > > 
> > > 
> > > e.result may be XML and not XMLListCollection.
> > > 
> > > 
> > > 
> > > ________________________________
> > > 
> > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > > Behalf Of Tracy Spratt
> > > Sent: Thursday, September 06, 2007 10:28 AM
> > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> 
> > > Subject: RE: [flexcoders] Populating XMLListCollection and sending
> it to
> > > a Datagrid
> > > 
> > > Are you sure onResult is getting called? If so, trace out
> > > dg2data.toXMLString() to make sure you have what you expect. You
> should
> > > see readable xml.
> > > 
> > > Make sure "name" is a first generation child node name in the item
> > > node.
> > > 
> > > Tracy 
> > > 
> > > ________________________________
> > > 
> > > From: [email protected]
<mailto:flexcoders%40yahoogroups.com> 
> <mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> ] On
> > > Behalf Of its_llpj
> > > Sent: Thursday, September 06, 2007 12:13 PM
> > > To: [email protected]
<mailto:flexcoders%40yahoogroups.com>
<mailto:flexcoders%40yahoogroups.com>
> 
> > > Subject: [flexcoders] Populating XMLListCollection and sending it
to
> a
> > > Datagrid
> > > 
> > > Hello, I'm trying to populate a datagrid. Here is my code.
> Everything
> > > works, but when I use the dataProvider dg2data within my datagrid
it
> > > comes back empty. I know there is data there, but not sure if I'm
> > > missing something.
> > > 
> > > public function onSelectFirstGrid(event:Event):void
> > > 
> > > {
> > > myRequest.addEventListener(Event.COMPLETE, onResult)
> > > myRequest.send(dg.selectedItem.myID);
> > > }
> > > 
> > > private function onResult(e:ResultEvent):void
> > > 
> > > {
> > > dg2data = e.result as XMLListCollection;
> > > }
> > > 
> > > private function onFault(e:FaultEvent):void
> > > 
> > > {
> > > Alert.show(e.fault.message, "Could not load");
> > > }
> > > 
> > > [Bindable]
> > > public var dg2data: XMLListCollection;
> > > 
> > > My DataGrid
> > > <mx:DataGrid id="dg2" width="100%" height="100%" rowCount="10"
> > > dataProvider="{dg2data}">
> > > <mx:columns>
> > > <mx:DataGridColumn dataField="name" headerText="Name" />
> > > </mx:columns>
> > > </mx:DataGrid>
> > > 
> > > Thanks!
> > >
> >
>

 

Reply via email to