This is a migrated thread and some comments may be shown as answers.
On Render Event
1 Answer 125 Views
This is a migrated thread and some comments may be shown as answers.
Joshua Austin
Top achievements
Rank 1
Joshua Austin asked on 12 Jun 2012, 05:03 PM
I have a list view that I have created.  I would like to trigger an event when an item in the list view is double clicked.

To do this, I have the following template:
<script id="uxMyTemplate" type="text/x-kendo-tmpl">
        <div class="cwcs_listItem" data-id="${ID}">
            <h2>${Name}</h2>
            <p>
                ${Description}
            </p>
        </div>
    </script>

And the following function to register the event:
function _setItemDoubleClickEvent() {
    var items = $(".cwcs_listItem");
    items.dblclick(function() { alert("Double Click!"); });
}

Unfortunately this doesnt do me any good before the data has been retrieved and the template rendered in the list view.
My question is: Is there an event I can register for which will be called when a kendo control has finished rendering a template?

1 Answer, 1 is accepted

Sort by
0
Iliana Nikolova
Telerik team
answered on 14 Jun 2012, 08:58 AM
Hello Joshua,

To achieve this you could hook up the dataBound event of the Kendo UI ListView. For example: 
$("#listView").kendoListView({
   dataSource: dataSource,
   template: kendo.template($("#uxMyTemplate").html()),
   dataBound: _setItemDoubleClickEvent
});
 
// ...
function _setItemDoubleClickEvent() {
   var items = $(".cwcs_listItem");
   items.dblclick(function() { alert("Double Click!"); });
}

Another approach for implementation of such functionality is to use jquery delegates. For example:
$("#listView").delegate(".cwcs_listItem", "dblclick"function() {
    alert("Double Click!");
});

I hope this helps. 

Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Joshua Austin
Top achievements
Rank 1
Answers by
Iliana Nikolova
Telerik team
Share this question
or