AnsweredAssumed Answered

Custom Dashlet not rendering HBS template

Question asked by chadhutchins on Apr 5, 2014
Latest reply on Apr 30, 2014 by paperless
I'm working on creating a custom dashlet for a Contact's intelligence panel.

Here's my js file:

({   
    plugins: ['Dashlet'],
    initDashlet: function() {},
    loadData: function (options) {
        if(_.isUndefined(this.model)){
            return;
        }

        var id = this.model.get('id');

        if (_.isEmpty(id) || _.isEmpty(email)) {
            return;
        }
        
        var request_data = {
            record_id: id,
        };
        
        app.api.call('create', app.api.buildURL('CustomModule/custom/action'), request_data, {
            success: function (data){
                var test = {activities:[{action: 'test1'},{action:'test2'},{action:'test3'}]};
                _.extend(this,test);
                this.render();
            }
        });
    }
})

My hbs template:

{{#if activities}}   
    <ul>
    {{#each activities}}
        <li>{{this.action}}</li>
    {{/each}}
    </ul>
{{else}}
    <p>No activities</p>
{{/if}}


I get data back from my ajax request, but i've hard-coded some for testing purposes. Every time the loadData function runs and tries to run this.render(), I get a "Object #<Object> has no method 'render'" javascript error.

Any ideas?

Outcomes