The correct way to access an object in a jquery-tmpl expression {{each}}

I am using jquery-tmpl . My object model is simple - SalesProspect, which contains a collection of SalesProspectAction objects. Both of these objects have a field called Status. How to get child status in each chain ? He always pulls the parent.

<script id="tmplActions" type="text/x-jquery-tmpl">
    <p>${GuestName}</p>
    <table class="stdtable" cellpadding="3" cellspacing="0" width="100%">
        <thead><tr><td>Date</td><td>By</td><td>Changed To</td><td>Notes</td></tr></thead>
        <tbody>
            {{each(i,action) SalesProspectActions}}
            <tr>
                <td>${DateCreated}</td>
                <td>${CreatedBy}</td>
                <td>${Status}</td>
                <td>${Notes}</td>
            </tr>
        {{/each}}
        </tbody>
    </table>
</script>

I tried several different things, for example {$action.Status}, etc., but no luck.

+5
source share
3 answers

As noted in my comment (despite typos ...), the syntax is ${action.Status}NOT {$action.Status}.

+2
source

Are you sure this code is not working?

{{each(i,action) SalesProspectActions}}
    <tr>
        <td>${action.Status}</td>
    </tr>
{{/each}}
+2

All Articles