Change event has allways backButtonPressed=true (args)

5 posts, 1 answers
  1. phx255
    phx255 avatar
    6 posts
    Member since:
    Feb 2016

    Posted 17 Nov 2016 Link to this post

    Hi!, i0m triying to use the event change to capture when user push the Backbutton but the event Change (args e.backButtonPressed) is allways true:

    I'm missing something?

    The app navigate when user push on link like this <a href="/#previsiones">Previsiones</a>

     

    01.SAOO.Routes = function () {
    02.    var router = new kendo.Router({
    03.        root: "/",
    04. 
    05.        routeMissing: function (e) {
    06. 
    07.        },
    08.        back: function (e)
    09.        {
    10.             
    11.             
    12.            SAOO.theme.page.leftMenu.change(e.url);
    13.        },
    14.        change: function (e) {
    15. 
    16.            
    17.            if (SAOO.application.loaded==false)
    18.            {
    19.                SAOO.theme.page.leftMenu.change(e.url);
    20.            }
    21.             
    22.            
    23. 
    24. 
    25. 
    26.             
    27.        },
    28.        root: "/"
    29.    });

    Thx!!

  2. Stefan
    Admin
    Stefan avatar
    361 posts

    Posted 21 Nov 2016 Link to this post

    Hello Jaime,

    I was able to observe the described behaviour on my side.

    Our developers' team will investigate it additionally.

    In the meantime, I can suggest the following workaround: 

    As the back event of the Router is fired before the change event when the back button is clicked, I can suggest using a flag to check if the back button is clicked:

    var flag = false;
    back: function(){
     flag = true;
    }
     
    change: function(){
     if(flag){
      //custom code
     }
     flag = false;
    }

    I hope this will help to achieve the desired result.

    Regards,
    Stefan
    Telerik by Progress
    Kendo UI is ready for Visual Studio 2017 RC! Learn more.
  3. phx255
    phx255 avatar
    6 posts
    Member since:
    Feb 2016

    Posted 21 Nov 2016 in reply to Stefan Link to this post

    I'm trying that code but back event is not working (not fired)

    I'm using Kendo UI v2016.3.1118

    Thanks!

  4. Answer
    Stefan
    Admin
    Stefan avatar
    361 posts

    Posted 23 Nov 2016 Link to this post

    Hello Jaime,

    I did notice that if the event handler is used in the Router initialization, the event is indeed not fired.

    Still, after testing, I can confirm that the event is correctly fired if the event is bind to the router after initialization. Please check how to bind the back event after the router is initialized:

    router = new kendo.Router({
        init: function() {
            main.render("#root");
        }   
    });
     
    router.bind("back", function (e) {
        console.log("back", e);
    });
     
    As this is not an expected behaviour, I will forward this to our developers' team for further investigation.

    Regards,
    Stefan
    Telerik by Progress
    Kendo UI is ready for Visual Studio 2017 RC! Learn more.
  5. phx255
    phx255 avatar
    6 posts
    Member since:
    Feb 2016

    Posted 23 Nov 2016 in reply to Stefan Link to this post

    Thanks! now it's works perfect.

     

Back to Top