This is a migrated thread and some comments may be shown as answers.

Route is missing, stay in current View

5 Answers 64 Views
SPA
This is a migrated thread and some comments may be shown as answers.
mgs
Top achievements
Rank 1
mgs asked on 25 Mar 2013, 06:27 PM
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

5 Answers, 1 is accepted

Sort by
0
Accepted
Petyo
Telerik team
answered on 27 Mar 2013, 12:22 PM
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!
0
mgs
Top achievements
Rank 1
answered on 27 Mar 2013, 05:10 PM
Hello Petyo,

thanks a lot for the answer.

Michael G. Schneider
0
Zachary
Top achievements
Rank 1
answered on 26 Jul 2013, 07:06 PM
@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
0
Petyo
Telerik team
answered on 29 Jul 2013, 11:49 AM
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!
0
Zachary
Top achievements
Rank 1
answered on 01 Aug 2013, 10:58 PM
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
Tags
SPA
Asked by
mgs
Top achievements
Rank 1
Answers by
Petyo
Telerik team
mgs
Top achievements
Rank 1
Zachary
Top achievements
Rank 1
Share this question
or