One thing you'll want to do is make sure your dataprovider is set to an array in the case where you are reading a directory that consists of only a single item. Flex will interpret that as an object instead of an array, so you will need the following:
function DocDisplayModdisplayDocsListQryResult( result ){ DocTree.dataProvider = mx.utils.ArrayUtil.toArray(result); } Doug --- In flexcoders@yahoogroups.com, "Jeremy Rottman" <[EMAIL PROTECTED]> wrote: > > In my app, I have a section that is suposed to display in a tree all > documents that are in a specific folder. > > The issue I have is that, when I test the code, the tree has this > output [object Object]. > > Is this because it not formated correctly in my cfc? Or is it > something more sinister and evil. > > I have this cfc code. This code works. > > <cffunction name="displayDocsListQry" access="remote" > returntype="array" output="true"> > <cfargument name="fileNum" required="no" type="string" /> > <cfdirectory action="list" recurse="yes" > directory="#APPLICATION.storePath##APPLICATION.systemInfo.fld_officeC ode#/L060001" > name="ListDir" /> > > <cfquery name="ListDirQry" dbtype="query"> > select * from ListDir > where type = 'Dir' > </cfquery> > <cfset dirArray = arrayNew(1)> > <cfset dcounter = 1> > <cfset fcounter = 1> > <cfloop query="ListDirQry"> > <cfset dirArray[dcounter] = structnew()> > <cfset dirArray[dcounter].dir = ListDirQry.name> > <cfquery name="ListFileQry" dbtype="query"> > select * from ListDir > where type = 'File' and directory = > '#APPLICATION.storePath##APPLICATION.systemInfo.fld_officeCode#/#ar guments.fileNum#/#dirArray[dcounter].dir#' > </cfquery> > <cfloop query="ListFileQry"> > <cfset dirArray[dcounter].file = ListFileQry.name> > </cfloop> > <cfif dcounter neq ListDirQry.RecordCount> > <cfset dcounter = dcounter + 1> > </cfif> > </cfloop> > <cfreturn dirArray /> > </cffunction> > > Now, I call this function like this. > > Webservice -- > <!-- POPULATES TREE --> > <mx:WebService id="DocDisplayMod" useProxy="false" > wsdl="http://flex.homesmartagent.com/cfc/adminList.cfc?wsdl" > showBusyCursor="true"> > <mx:operation name="displayDocsListQry" > result="DocDisplayModdisplayDocsListQryResult ( > DocDisplayMod.displayDocsListQry.result )" > fault="DocDisplayModdisplayDocsListQryFault( event )" /> > </mx:WebService> > > AS Connected to the webservice: > > function DocDisplayModdisplayDocsListQry (fileNum){ > DocDisplayMod.displayDocsListQry(fileNum);} > > // called when results received > function DocDisplayModdisplayDocsListQryResult( result ){ > DocTree.dataProvider = result; > } > > function DocDisplayModdisplayDocsListQryFault ( event ){} > > > Code for my tree: > <mx:Tree x="10" id="DocTree" rootVisible="true" y="10" height="75%" > width="85%"/> > -- 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/