Binding Tap events after loading information from dataSource.

2 posts, 1 answers
  1. Davin
    Davin avatar
    10 posts
    Member since:
    May 2012

    Posted 11 Nov 2013 Link to this post

    I am following this demo:
    http://demos.kendoui.com/mobile/scrollview/custom-template.html#/

    What I am not able to figure out is how to bind a Tap event either after the new pages are rendered.

    $('.
    batch-page .gallery-page .tile').kendoTouch({tap: function (e) {
       alert('Hello")
    }});

    Normally I would just jquery's live on method, but I need the kendo tap binding.
  2. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2891 posts

    Posted 13 Nov 2013 Link to this post

    Hello Davin,

    In order to achieve that you should bind to the change event of the ScrollView, get a reference to the array that holds the pages and create a .kendoTouch component on the element located at the current page.
    Do not forget to destroy the previously created widgets on other pages.
    function onChange(e) {
        var pages = this._content.pages;
     
        kendo.destroy(pages[0].element);
        kendo.destroy(pages[2].element);
     
        pages[1].element.find(".image").kendoTouch({
            tap: function(e) {
                console.log("tap!");
            }
        });
    }


    For your convenience I prepared a small example:

    Regards,
    Alexander Valchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top