Route is missing, stay in current View

6 posts, 1 answers
  1. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 25 Mar 2013 Link to this post

    If Kendo cannot find a route, method "routeMissing" is called. When that method gets executed, the URL has already changed. What can be done, so the current view and the browser's URL do not change?

    I tried to call preventDefault on the event object, as can be done in the change event. However, that did not work.

    Michael G. Schneider
  2. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 27 Mar 2013 Link to this post

    Hi Michael,

    Thank you for your feedback. Your expectation makes sense; we will introduce this change in our next internal build (as it is not a breaking change). I am updating your telerik points for this finding. 

    All the best,
    Petyo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. mgs
    mgs avatar
    163 posts
    Member since:
    Jan 2011

    Posted 27 Mar 2013 Link to this post

    Hello Petyo,

    thanks a lot for the answer.

    Michael G. Schneider
  5. Zachary
    Zachary avatar
    23 posts
    Member since:
    Feb 2013

    Posted 26 Jul 2013 Link to this post

    @Michael, thank you for posting this. It was bothering me too!

    @Petyo, the fix is much appreciated!

    Just updated Kendo UI in my application and was happy to discover that this works now. It is worth noting that I had to include e.preventDefault() in the routeMissing function.

    The documentation should be updated to reflect this change. I went there before I stumbled upon this thread. API Reference > Framework > Kendo Router > change has a callout that should be copied down to routeMissing.

    Thanks again!
    Zachary
  6. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 29 Jul 2013 Link to this post

    Hello Zachary,

    Thank you for your feedback - we updated the article in question. 

    Regards,
    Petyo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Zachary
    Zachary avatar
    23 posts
    Member since:
    Feb 2013

    Posted 01 Aug 2013 Link to this post

    It is worth noting that in kendo.Router.routeMissing, e.preventDefault exhibits two types of behavior. If you are on a valid route (e.g. #/page1) and click a link to an invalid route (e.g. #/missing), preventDefault works as expected, and keeps you on #/page1. If you are on #/page1, however, and type #/missing directly into the address bar, preventDefault drops you on the valid route you were on before #/page1 (e.g. #/page0).

    I can live with this, because I doubt users will type routes into the address bar very often.

    Thanks again Petyo!
    Zachary
Back to Top
Kendo UI is VS 2017 Ready