Very confused where to start...

7 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Jun 2014 Link to this post

    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
  2. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 05 Jun 2014 Link to this post

    Assumptions:

    Router is what keeps an eye on the url and loads the proper views...

    router.route("/", function () {
        $views.master.render("#app");
    });
     
    router.route("/user/:username", function (username, params) {
        $views.detail.render("#app");
    });

    So in this case each view will plop itself into <div id="app">

    On click of an item in my list I would call
    router.navigate("/user/" + dataItem.Username);

    So what happens is my "detail" pane just gets appended below the "master"...so "#app" now has 2 child divs.

    I thought the entire concept is that the views are swapped unless I specify a router.append()?
  3. Kendo UI is VS 2017 Ready
  4. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 09 Jun 2014 Link to this post

    Hello Steve,

    The behavior you describe is by design and documented:

    Renders the view contents. Accepts a jQuery selector (or jQuery object) to which the contents will be appended

    If I understand you correctly, the layout showIn method will do what you are expecting (swap one view element with the other). 

    I am not sure what do you mean by router.append, though. The router does not have such method. Can you please clarify?

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Jacques
    Jacques avatar
    135 posts
    Member since:
    Jun 2007

    Posted 19 Oct 2015 in reply to Steve Link to this post

    Hey Steve,

    I know it's over a year ago, but how did you eventually get on with this? I'm always frustrated with Telerik's documentation and again in the case of SPA/View/Layout it was no different and I also found myself completely baffled.

    At the moment I'm stuck with another concept: We have a view with a list of quotes and another 4 views which separate out each individual quote into steps in a wizard. Loading the first quote into the wizard Views works fine.
    The View object though doesn't have a LoadModel, or ChangeModel method, you can only instantiate the object with the model, if you then wanted a different ViewModel attached to the view it looks like you'll have to re-instantiate the View object along with a new ViewModel.

    So what I tried was to create a LoadData method on the actual ViewModel which goes through each of the properties assigning new values using the typical MVVM this.set("myprop", value) syntax. The ViewModel definitely has new data, but the View is never updated.

    Again, this leads me to believe that by design you have to instantiate a new View each time you want to attach a new ViewModel to it.

  6. Jacques
    Jacques avatar
    135 posts
    Member since:
    Jun 2007

    Posted 20 Oct 2015 Link to this post

    The screenshot attached for an example of what is available on that View object vs. what is documented:

     

     

  7. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 21 Oct 2015 Link to this post

    Hi Jacques,

    the methods listed in firebug are internal to the SPA implementation and are not meant to be used by the SPA client. This is the reason why they are not documented.

    In case you need any assistance with the case you describe, I may suggest that you open a support ticket with a reproducible sample. I am not sure that this forum thread is related to the issue you experience. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Jacques
    Jacques avatar
    135 posts
    Member since:
    Jun 2007

    Posted 21 Oct 2015 in reply to Petyo Link to this post

    My comments in this thread are about your documentation, but I have already started a separate thread here: 

    http://www.telerik.com/forums/how-do-you-update-the-model-that-the-current-view-is-using

     ​

Back to Top
Kendo UI is VS 2017 Ready