I am using the excellent jTemplates plugin to generate content.
Given a data object like this...
var data = {
name: 'datatable',
table: [
{id: 1, name: 'Anne'},
{id: 2, name: 'Amelie'},
{id: 3, name: 'Polly'},
{id: 4, name: 'Alice'},
{id: 5, name: 'Martha'}
]
};
..I'm wondering if it is possible to directly specify an object in an array of objects using $T. (I'm hoping there is something like $T.table:3 available)
Currently the only way I can think of to access a specific object in an array is to do something like this...
{#foreach $T.table as record}
{#if $T.record$iteration == 3}
This is record 3! Name: {$T.record.name}
{#/if}
{#/for}
However that seems clumsy...
Any suggestions?
Thanks