Try this:

function DocDisplayModdisplayDocsListQryResult( result ){
    var resultArray: Array = mx.utils.ArrayUtil.toArray(result);
    for (var i = 0; i < resultArray.length; i++) {
        DocTree.addTreeNode(resultArray[i].dir);
    }
}

You can also add an optional data object to the addTreeNode() 
function, as the 2nd parameter.

--- In [email protected], "Jeremy Rottman" <[EMAIL PROTECTED]> 
wrote:
>
> I have added the code you suggested and it still just displays it 
as
> [object Object].
> I even trimed my cfc down to this, just to test the folders.
> 
>       <cffunction name="displayDocsListQry" access="remote"
> returntype="array" output="true">
>               <cfargument name="fileNum" required="no" 
type="string" />
>                       <cfdirectory action="list"
> 
directory="#APPLICATION.storePath##APPLICATION.systemInfo.fld_officeC
ode#/#arguments.fileNum#"
> name="ListDir" />
>                               <cfset dirArray = arrayNew(1)>
>                               <cfset dcounter = 1>
>                                  <cfloop query="ListDir">
>                                          <cfset dirArray[dcounter] 
= structnew()>
>                                          <cfset dirArray
[dcounter].dir = ListDir.name>
>                                          <cfset dcounter = 
dcounter + 1>
>                                  </cfloop>
>               <cfreturn dirArray />
>       </cffunction>
>       
> 
> --- In [email protected], "Doug Lowder" <douglowder@> 
wrote:
> >
> > 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 [email protected], "Jeremy Rottman" <jarottman@> 
> > 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/
 



Reply via email to