A better way to receive a promise on drawer's transition completion?

3 posts, 0 answers
  1. Sergei
    Sergei avatar
    44 posts
    Member since:
    Aug 2012

    Posted 02 Mar 2014 Link to this post

    I have observed that drawer animation becomes "jumpy" if view performs a lot of data loading and binding on show. As a way around it, I am building postponing any heavy duty processing until the animation is completed.

    I am using deferred promises to watch for the transition to complete using the following. Here's a question: is there a way to do it?

    $.Deferred(function(){
        var promise = this;
        timer = setInterval(function() {
            if ($("#my-drawer:not(:visible)")[0]) {
                clearInterval(timer);
                promise.resolve();
            
        }, 100);
    })
  2. Sergei
    Sergei avatar
    44 posts
    Member since:
    Aug 2012

    Posted 02 Mar 2014 in reply to Sergei Link to this post

    A slightly better version. But I'd like to get rid of the timer. 

    $.Deferred(function(){
                var     promise = this,
                        kendoDrawer = $("#my-drawer").data("kendoMobileDrawer");
                timer = setInterval(function() {
                    if ( !kendoDrawer.visible && !kendoDrawer._transitioning ) {
                        clearInterval(timer);
                        promise.resolve();
                    
                }, 100);
            })
  3. Kendo UI is VS 2017 Ready
  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 03 Mar 2014 Link to this post

    Hello Sergei,

    Currently the hide event of the Drawer fires when the closing animation starts. I agree that it will be useful to have an event that fires when this animation is completed, so I have added this to our internal tracker and it will be implemented with one of the next builds.

    In the mean time, I cannot offer you a solution that uses the Drawer API to achieve the functionality that you are looking for (will be addressed when the new event is added) and your solution seems like the best possible way to achieve what you are looking for at the moment.

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