vendredi 29 mai 2015

Ember: Helper inside Component renders undefined

I have component which renders a grid and it uses a helper to render each row. I'm getting undefined instaed of actual data. If I directly render the data without the helper the actual data is rendered. Please find the code below

Gird Comp

{{#each data in dataValues}}
    {{ log " grid-comp "  data.title //title is rendered correctly}}
    {{grid-row data}}
{{/each}}

Grid Row Helper

export function gridRow(data) {
    console.log(data.title); //undefined
    var row;
    row='<tr><td>'+data.id+'</td><td>'+data.title+'</td><td>'+data.publishDate+'</td><td>'+data.comments+'</td></tr>';
    return new Ember.Handlebars.SafeString(row);
}

Note: The data comes from the Fixture




Aucun commentaire:

Enregistrer un commentaire