coolony / kiwi

Simple yet powerful asynchronous JavaScript template engine based on jQuery Template syntax, usable server-side or client-side.
MIT License
41 stars 6 forks source link

Outputting Complex Data List #20

Open rhythmicdevil opened 12 years ago

rhythmicdevil commented 12 years ago

Hi, I am having a really difficult time outputting a complex list of data. I was wondering if you would mind pointing me in the right direction. I have an object of objects that contain an array of objects. I cant seem to figure out the right combination of kiwi eachs to use to create an HTML UL from this. I figured I would try the raw tag and just do it in Javascript but the script tag make Kiwi throw an error.

Here is a sample of my data structure:

"monitoring": [
    {
        "Monitoring Most Recent Feed": [
            {
                "resultCode": "NO TESTS FOUND"
            }
        ]
    }
],
"cloud_sandbox": [
    {
        "Cloud Sandbox File": [
            {
                "test": "noname",
                "resultCode": 200
            },
            {
                "test": "noname",
                "resultCode": 200
            }
        ]
    }
],

Here is what I want the output to be:

    <ul>
        <li>monitoring</li>
            <ul>
                <li>Monitoring Most Recent Feed</li>
                    <ul>
                        <li>resultCode: NO TESTS FOUND</li>
                    </ul>
            </ul>
        <li>cloud_sandbox</li>
            <ul>
                <li>Cloud Sandbox File</li>
                    <ul>
                        <li>test: noname</li>
                        <li>resultCode: 200</li>
                    </ul>
                    <ul>
                        <li>test: namename</li>
                        <li>resultCode: 200</li>
                    </ul>
            </ul>
    </ul>

Any advice you may have to help achieve this would be greatly appreciated.

Thanks Steve