I am using kendo ui router and want to replace a URL parameter on each change of the route. So on the change event of the router I have the following code:
window.history.replaceState({}, document.title, getUpdatedUrl())
The parameter I want to add is updated successfully, but when I navigate back or forward the kendo ui router no longer catches these events, and does not navigate to the appropriate view (the page URL changes properly). Any ideas how to fix this?
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!!
I'm getting an error when trying to navigate to a route:
TypeError: r is undefined
kendo.all.min.js (line 26, col 20881)
All I've done is set up a basic router, with one route and receive this error when trying to navigate to that route.
HTML:
<
div
class
=
"col-sm-3 col-lg-2 zero-padding sidebar sidebar-fixed"
>
<
div
class
=
"col-sm-3 col-lg-2 sidebar-fixedsub zero-padding"
>
<
ul
id
=
"accordion"
class
=
"accordion side-menu"
>
<
li
class
=
"hidden-xs"
>
<
div
class
=
"sidebar-actions"
>
<
button
id
=
"menu_resize"
data-role
=
"button"
class
=
"k-button resize-menu-level-1"
role
=
"button"
aria-disabled
=
"false"
data-level
=
"1"
>
<
i
class
=
"fa-icon-bars"
></
i
>
</
button
>
</
div
>
</
li
>
<
li
id
=
"subscribed"
>
<
a
class
=
"link k-link"
><
i
class
=
"fa-icon-comments"
></
i
><
span
class
=
"nav-item-text nav-item-text-main"
>Subscribed</
span
></
a
>
<
ul
class
=
"submenu"
>
<
li
><
a
onclick
=
"navigateContainer($(this));"
><
span
class
=
"nav-item-text"
>Subscription 1</
span
><
span
class
=
"badge"
>5</
span
></
a
></
li
>
</
ul
>
</
li
>
</
ul
>
</
div
>
</
div
>
Router JS:
var
router =
new
kendo.Router({
routeMissing:
function
(e) {
e.preventDefault();
}
});
router.route(
"/"
,
function
() {
generateDiscussionView();
});
router.route(
"/thread/:containerid"
,
function
(containerid) {
triggerContainer(container);
});
$(
function
() {
router.start();
});
Main JS:
function
navigateContainer(container) {
router.navigate(
"/thread/"
+ container);
}
function
triggerContainer(container) {
generateDiscussionView();
}
Hi there,
I was wondering if it's possible to remove the # from the routing in a Kendo SPA application.
In angularjs you set the locationProvider to use "html5" mode and it relies upon the web server being smart enough to serve any request underneath the spa to the main spa page.
For example
http://www.example.com/spa/#/main
would become
http://www.example.com/spa/main
Thanks,
Devin
It says it should appear only when back button is pressed, but this is not the case in version 2016.1.125.
There are some changes in kendo.router.js file in _checkUrl method which I think is not correct. backCalled is always undefined, which means backButtonPressed parameter in trigger method is always true.
if
(
this
.trigger(CHANGE, {
url: current,
backButtonPressed: !backCalled
Okay so you load a model
var
myModel =
new
kendo.observable({ name: "John", surname: "Doe" });
Then you load a view:
var
myView =
new
kendo.View(
"idOfTemplateScriptTag"
, {model: myModel});
Assume you had a layout object called myLayout:
myLayout.showIn(
"#content"
, myView,
"swap"
);
This works just fine. Everything okay up to this point.
But the documentation doesn't seem to say anything about how you're meant to replace the model in that view and still have MVVM properly bind all the new values to the relevant HTML elements. There are only two methods:
Are you supposed to:
I've got my router and routes set up, and now I'm trying to implement the navigation, but router.navigate isn't updating the URL and I'm not sure why.
There's a link on my page that's meant to pull up a different view; the onclick for the link is bound to the navigatePage function:
function
navigatePage(page) {
var
category_id = page.data(
"categoryid"
);
var
page_id = page.data(
"pageid"
);
router.navigate(
"/category/"
+ category_id +
"/page/"
+ page_id);
}
This is the route it's going to:
router.route(
"/category/:categoryid/page/:pageid"
,
function
(categoryid, pageid) {
openPage(categoryid, pageid);
});
Which then calls the function to actually change the views. However, when I run the page, I can see (via console.log) that navigatePage is being called, then the route, but the URL never changes and the default route kicks in (I'm assuming because the URL hasn't been modified?).
So I went to record what I was seeing for you, and noticed that the URL is actually changing (you can see it blip in the vid), but the somehow it's being reset. I don't have any other navigate calls in my javascript. Here's the default route, in case that's relevant:
router.route(
"/"
,
function
() {
generateView();
});
Where am I going wrong?