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

Event bind in ListView editTemplate doesn’t work properly

1 Answer 126 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Jodow
Top achievements
Rank 1
Jodow asked on 11 Dec 2015, 02:30 AM

Hi guys,

my viewModel:

 

var uploadVM = kendo.observable({
    onUpload: function(e) {
        Codes Here
    }
});

editTemplate

 

<script type="text/x-kendo-tmpl" id="editTemplate">
    <div class="product-view k-widget">
        <dl>
            <dt>Product Photo</dt>
            <div>
                <input id="editUpload" name="itemPic"
                    type="file"
                    data-role="upload"
                    data-model="uploadVM"
                    data-bind="events: { upload: onUpload }"
                    data-multiple="false"
                    data-async="{
                        saveUrl: saveURL,
                        removeUrl: removeURL,
                        removeVerb: 'DELETE',
                        autoUpload: true
                    }" />
            </div>
        </dl>
        <div class="edit-buttons">
            <a class="k-button k-update-button" href="\\#"><span class="k-icon k-update"></span></a>
            <a class="k-button k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span></a>
        </div>
    </div>
</script>

listView initiate with

 

var listView = $("#product-listview").kendoListView({
    dataSource: ListViewDataSource,
    template: kendo.template($("#template").html()),
    editTemplate: kendo.template($("#editTemplate").html())
}).data("kendoListView");

but The UPLOAD event: upload work with error message: Uncaught TypeError: n is not a function

Any suggestion will be appreciated.

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 15 Dec 2015, 11:26 AM

Hello Jodow,

 

for the mvvm bindings in the template to work as expected, the listview should be instantiated with data-role="listview" attribute - you are currently instantiating the widget with the jQuery plugin syntax. 

 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Templates
Asked by
Jodow
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or