0
votes

I have a listview template with a button on it. I have bound an click event from the html declaration.

<div data-role="listview" class="app-area-listview"
                                 data-template="template"
                                 data-bind="source: dataList">   </div>

<script type="text/x-kendo-tmpl" id="template">
                    <div class="col-md-3">
                        <div class="col-md-8">
                                <h4>#:Name#</h4>
                            </div>
                            <div class="col-md-1">
                                <div class="edit-buttons">
                                    <button data-toggle="button" data-bind="click:onEdit" class="btn btn-white btn-lg ">
                                    </button>
                                </div>
                            </div>
                    </div>
                </script>

In the view model I have "onEdit" function.

If I bind "dataList" property as a JSON array, this function on the view model will trigger without any issue, but If I bind a kendo datasource it cannot find the function.

If any one of you have understanding how this get to work, would be a great help.

Thank you.

2

2 Answers

0
votes

Probably there is problem with scope. Try debug it and check scope of template.

 <script type="text/x-kendo-tmpl" id="template">
      #debugger;#
      .
      .
      .
</script>
0
votes

use following code instead of yout code

<script type="text/x-kendo-tmpl" id="template">
                <div class="col-md-3">
                    <div class="col-md-8">
                            <h4>#:Name#</h4>
                        </div>
                        <div class="col-md-1">
                            <div class="edit-buttons">
                                <button data-toggle="button" onclick="onedit(e)" class="btn btn-white btn-lg ">
                                </button>
                            </div>
                        </div>
                </div>
            </script>