user1029968
user1029968

Reputation: 297

JsRender and accessing nested objects

I am using jQuery and JsRender to render my template.

Here is my jsfiddle example: http://jsfiddle.net/kWBFS/8/

Could anyone please tell me how should I access values of particular arrays?

Currently I'm gettin only [object Object] and don't know how to access its contents.

Thanks a lot!

Upvotes: 1

Views: 899

Answers (1)

colestrode
colestrode

Reputation: 10658

I've never used jsRender before, but this template seems to give you the correct output. You need to iterate over the items in the R1 array using a for loop:

<script id="template" type="text/x-jsrender">
    {{for R1}}
        Column: {^{:#index+1}}
        {{for #data}}
            <p>{{:K1}} {{:K2}}</p>
        {{/for}}
        <br>
    {{/for}}
    <br>
</script>

Upvotes: 2

Related Questions