I hate to bother the group with this, but I've googled and read docs and still 
my code does not work. :-(

I am using CF9 and running ColdBox 3.0M5. I have retrieved data using ORM and 
placed it in the request context (variable rc). I am now trying to loop over 
the array to display the data. I have tried two versions of looping and both 
fail. The cfdump (when active) does show that I have an array of List 
components (only 1). This component also contains another array of Item 
components (4 of them). Here is the first few lines of the dump:

array
1       
[cfc1] component todos.model.List
PROPERTIES      
listid  1
name    Web Infrastructure
priority        1
items   
array
1       
[cfc2] component todos.model.Item

When the first cfloop is executed, I get an error stating: Element NAME is 
undefined in a Java object of type class coldfusion.orm.PersistentTemplateProxy.

When the second cfloop is executed, I get an error stating: Element NAME is 
undefined in LIST.

I realize I must be doing something wrong with either the dot notation or 
casting (does CF require casting? I didn't think so), or something else fairly 
basic. I just don't see it. 

The code being executed (with the first loop and cfdump currently commented 
out) is below:

<!--- <cfdump var="#rc.lists#">
<cfabort> --->
<cfoutput>IsArray(rc.lists) = #IsArray(rc.lists)#</cfoutput>
<!--- Putting it in a padded div so that it doesn't hug the sides of the 
browser --->
<div style="padding: 20px;">
        <cfoutput>
        <table>
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Priority</th>
                </tr>
            </thead>
            <tbody>
                <!--- <cfloop index="i" from="1" to="#ArrayLen(rc.lists)#">
                <tr>
                    <td>#rc.lists[i].name#</td>
                    <td>#rc.lists[i].priority#</td>
                 </tr>
                                </cfloop> --->

                <cfloop array=#rc.lists# index="list">
                <tr>
                    <!--- <td><a 
href="#Event.buildLink('List/show/#list.listid#')#">#list.name#</a></td> --->
                    <td>#list.name#</td>
                    <td>#list.priority#</td>
                </tr>
                </cfloop>
            </tbody>
        </table>
        
    </cfoutput>
</div>

Any help is appreciated! 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334069
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to