SPA sample

5 posts, 0 answers
  1. Sagi
    Sagi avatar
    60 posts
    Member since:
    Sep 2008

    Posted 24 Dec 2015 Link to this post

    Hello,

    I was looking today at the blog post http://www.telerik.com/blogs/please-respect-the-back-button

    when running the sample http://jsbin.com/OHemASes/3 i was able to see that pressing back button after navigating to the "Orders" links works as expected when 

    moving between pages.

    However, after moving to a specific page I have copied the url (http://output.jsbin.com/OHemASes/3#/orders/5) and paste it to a new browser instance.

    The router did direct the app to Orders view but the selected page was 1.

    Shouldn't page 5 supposed to be selected in this scenario ?

    thx

    Sagi

     

  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 25 Dec 2015 Link to this post

    Hello Sagi,

    See the adjusted snippet. The paging should happen after the grid is rendered, and the auto-binding should be omitted. This also eliminates some lines of code that check if the paging should be performed.

    Regards,
    Alex Gyoshev
    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
  4. Sagi
    Sagi avatar
    60 posts
    Member since:
    Sep 2008

    Posted 25 Dec 2015 in reply to Alex Gyoshev Link to this post

    The snippet does work, thx..

    However , I still do not understand one thing in the original implementation (that does not work)  :

    The following lines :

    if (dataSource.page() != page) {
    dataSource.page(page);
    }

     

    which suppose to move the grid to the correct page :are placed after the line which which suppose to render the grid :

     layout.showIn('#content', views.orders);

    I can also see that  views.orders.element property is already initialized before dataSource.page(page); is executed.

    Can you please explain why doesn't it work ?

    Thx

    Sagi

     

  5. Sagi
    Sagi avatar
    60 posts
    Member since:
    Sep 2008

    Posted 25 Dec 2015 in reply to Sagi Link to this post

    Does the grid is rendered sync ? 

    If so is this kendo code which perform this in async way or browser optimizations (e.g. first , execute all method command and only than move to DOM rendering)

    When using the calling dataSource.page(page); inside setTimeout (just for testing) , the code does work when hitting the url in a different browser (I guess that the grid was able to render during this time...)

     

    thx

     

  6. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 25 Dec 2015 Link to this post

    Hello Sagi,

    The problem with the previous example was that the dataSource.page call was executed when the dataSource was already making a request, thus it gets dropped. The workaround is to set autoBind: false on the DataSource and use the query method, which correctly loads the page.

    Regards,
    Alex Gyoshev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready