Dynamically load View with Layout

2 posts, 0 answers
  1. Kent
    Kent avatar
    2 posts
    Member since:
    Nov 2010

    Posted 26 Aug 2014 Link to this post

    How do you dynamically load a view and layout?  I can get the view to work by itself, but not a view with layout.  I created the simple example below to illustrate the issue.  The only way I can make this work is to place the layout in the index.html file, which means it's not dynamically loaded at runtime.

    // insert view
    $('body').append("<div data-role='view' id='view2' data-layout='main'>This is view2</div>")

    // insert layout
    $('body').append("<div data-role='layout' data-id='main'><header data-role='header'>Header</header><!-- application views will be rendered here --><footer data-role='footer'>Footer</footer></div>");

    // display view
    app.navigate('#view2');
  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 27 Aug 2014 Link to this post

    Hi,

    Unlike views, layouts are parsed and instantiated when the mobile application is instantiated. In case you load these contents from another resource, you may use remote views instead - if the response contains a layout definition, it will be parsed and applied. 

    Regards,
    Petyo
    Telerik
     
    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
Back to Top