This might help, hope it does. http://www.returnundefined.com/2006/07/datagrid-labelfunction-and-namespaces/
--- In [email protected], "Brian" <[EMAIL PROTECTED]> wrote: > > I've been trying to get a DataGrid populated from a WebService and > having much trouble. I'm wondering if the issue might be namespace > issues, but I'm confused by the usage and syntax of namespace from the > posts I've found here on that. There is no data in the DataGrid, but > it does appear to flicker and slightly resize it self when I call the > service so it looks like _something_ is going on. I've bound the > service response to an XMLListCollection so I can trace() it and I can > see the XML tree that should be displayed in the DataGrid. > > Any ideas why it's not working? Would appreciate any help, been > banging my head on this for days now. Thanks. > > Here is the mxml : > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute"> > > <mx:Script> > <![CDATA[ > import mx.collections.XMLListCollection; > import mx.controls.Alert; > import mx.rpc.events.ResultEvent; > private namespace ovServices = > "http://services.company.com"; > use namespace ovServices; > [Bindable] > public var ordMedList:XMLListCollection; > public var ordMedXMLList:XMLList; > > public function > handleOrdMedSearch(event:ResultEvent):void { > trace("handling OrdMedSearchResult"); > var resultXML:XML = XML(event.result); > ordMedXMLList = resultXML.child("OrdMedList"); > //trace("ordMedList : " + ordMedList); > ordMedList = new > XMLListCollection(ordMedXMLList); > } > ]]> > </mx:Script> > > <mx:WebService id="ordMedSearchWS" > > wsdl="http://localhost:8080/OrderViewWeb/services/OrderableMed?wsdl" > showBusyCursor="true"> > <mx:operation name="searchStartsWith" resultFormat="e4x" > result="handleOrdMedSearch(event)"> > <mx:request> > <searchText>{ordMedSearchText.text}</searchText> > </mx:request> > </mx:operation> > </mx:WebService> > > <mx:HBox x="10" y="70"> > <mx:Label text="Orderable Med Search" /> > <mx:TextInput id="ordMedSearchText" width="100"/> > <mx:Button label="Search" > click="ordMedSearchWS.searchStartsWith.send()"/> > <mx:Label /> > </mx:HBox> > > <mx:DataGrid x="10" y="100" id="ordMeds" width="400" > dataProvider="{ordMedList}"> > <mx:columns> > <mx:DataGridColumn headerText="Id" > dataField="id" width="100"/> > <mx:DataGridColumn headerText="Desc" > dataField="desc" /> > </mx:columns> > </mx:DataGrid> > > </mx:Application> > > Here is the xml from the trace : > > <OrdMedList xmlns:ns1="http://services.company.com/" > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> > <ns2:OrdMed xmlns:ns2="http://services.company.com"> > <ns2:desc xmlns="http://services.company.com">tylenol</ns2:desc> > <ns2:id xmlns="http://services.company.com">7607</ns2:id> > </ns2:OrdMed> > <ns2:OrdMed xmlns:ns2="http://services.company.com"> > <ns2:desc xmlns="http://services.company.com">aspirin</ns2:desc> > <ns2:id xmlns="http://services.company.com">7608</ns2:id> > </ns2:OrdMed> > <ns2:OrdMed xmlns:ns2="http://services.company.com"> > <ns2:desc xmlns="http://services.company.com">ibuprofen</ns2:desc> > <ns2:id xmlns="http://services.company.com">7609</ns2:id> > </ns2:OrdMed> > </OrdMedList> >

