This is a migrated thread and some comments may be shown as answers.

Link declared in a template, error when firing click event

1 Answer 27 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
T
Top achievements
Rank 1
T asked on 06 Sep 2014, 08:21 PM
Hi,

I have a Link declared in a template as shown in the code below. When I click on a link in the listview I get the error: "Uncaught TypeError: Object [object Object] has no method 'apply' "

Thanks in advance.

html:
<div data-role="view" id="componentOverview" data-title="Component Overview" data-model="APP.componentOverview.model" data-init="APP.componentOverview.events.init" data-after-show="APP.componentOverview.events.afterShow">
    <h1>Component Overview</h1>
    <ul data-role="listview" data-style="inset" data-bind="source:components" data-template="componentsTemplate"></ul>
</div>
 
<script type="text/x-kendo-template" id="componentsTemplate">
    <a data-bind="click: onComponentSelect">#: title#</a>
</script>

js:
define([
    'view/view',
    'text!view/componentOverview/componentOverview.html',
    'app'
], function (View, html, app) {
 
    var model = kendo.observable({
        components: app.data.components,
        onComponentSelect: function(e) {
            var compId = e.data.id;
            app.instance.navigate('componentDetail?id=' + compId);
        }
    });
 
    var events = {
        init: function (e) {
        },
        show: function (e) {
        },
        afterShow: function (e) {
        }
    };
 
 
    return new View('componentOverview', html, model, events);
});

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 10 Sep 2014, 11:18 AM
Hello,

the view definition does not seem familiar to me, but I assume that this is your own abstraction. Based on the snippet, I prepared the following example, and it seems to work as expected. Perhaps I am missing something? 

Regards,
Petyo
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
General Discussion
Asked by
T
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or