Telerik Forums
Kendo UI for jQuery Forum
5 answers
207 views

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?

Boyan Dimitrov
Telerik team
 answered on 29 Nov 2016
4 answers
90 views

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!!

phx255
Top achievements
Rank 1
 answered on 23 Nov 2016
3 answers
554 views

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();          
}

Dimo
Telerik team
 answered on 22 Jun 2016
5 answers
192 views

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

Petyo
Telerik team
 answered on 22 Mar 2016
3 answers
58 views

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

Petyo
Telerik team
 answered on 11 Feb 2016
7 answers
585 views

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:

  1. Destroy and
  2. Render

Are you supposed to:

  1. Reset the myModel properties back to defaults then set them to the new data that you want to display, or
  2. Instantiate a new View and Observable and render them by using ShowIn on the layout object?
Dimo
Telerik team
 answered on 09 Nov 2015
6 answers
143 views
Demos and docs are WILDLY incomplete.  Great we have demo apps, but you can't load them into the dojo and there's no tutorials on how they were built.  The docs have a basic hello world, but it's one view...and all of the concepts are segregated into sub pages.

So this is what I want to do:
1) Main page, has 2 "Views"...master and detail
2) When an item in the master list is clicked, load in the detail view and it's model

Sounds easy, but I've been brickwalled on it for the last hour...no idea what to do.  Like do I create all my view objects first, then create all my routes...do I call router.start after that, or do I call start then create the other routes...do I need a master layout?...I don't THINK I do, but it's impossible to know from the docs...shouldn't the router load in the right view on navigate, I shouldn't need to call .render() right?

Just baffled, even enhancing the hello world with minor view swapping
Jacques
Top achievements
Rank 2
 answered on 21 Oct 2015
4 answers
96 views
The sample on http://docs.kendoui.com/getting-started/framework/spa/overview has a typo. Calling "render" should not be applied to "view" but to "index" instead.

After testing http://docs.kendoui.com/getting-started/framework/spa/router it seems as if both routes "/foo" and "#/foo" were accepted by the "navigate" method. Is it ok to use one or the other?

Regarding http://docs.kendoui.com/getting-started/framework/spa/view what is the recommended way for destroying a view. Is setting the container's innerHtml ok?

Michael G. Schneider
Jacques
Top achievements
Rank 2
 answered on 20 Oct 2015
1 answer
96 views

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?

Plamen Lazarov
Telerik team
 answered on 12 Oct 2015
3 answers
105 views
Is there any way to use the router along with a route defined in the query string as in the subject?

I am building a SPA within SharePoint 2010 and I MUST access the page using a URL like  domain.com/site/_Layouts/page.aspx  

I have tried using domain.com/site/_Layouts/folder/ by renaming the page default.aspx but that seems to kill the SP Client Side Object Model.

Is it still possible to use the router? And how?
Phil H.
Top achievements
Rank 2
 answered on 01 Aug 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?