ScrollView stops scrolling after a second call to content()

3 posts, 1 answers
  1. Vaughn
    Vaughn avatar
    9 posts
    Member since:
    Nov 2012

    Posted 23 Jan 2013 Link to this post

    WORKS:
    var data = JSON.parse(localStorage.getItem('some_stored_json_data'));
    var template = kendo.template($("#template").text());
    var content = kendo.render(template, data);
    $("#scrollview").kendoMobileScrollView().data("kendoMobileScrollView").content("<!--" + content + "-->");

    DOES NOT WORK:
    var data = JSON.parse(localStorage.getItem('some_stored_json_data'));
    var template = kendo.template($("#template").text());
    var content = kendo.render(template, data);
    $("#scrollview").kendoMobileScrollView().data("kendoMobileScrollView").content("<!--" + content + "-->");
    $("#scrollview").kendoMobileScrollView().data("kendoMobileScrollView").content("<!--" + content + "-->"); // the only line different

    I have ScrollView running fine with the "WORKS" code above (Templates and other HTML not attached). 

    However, though the above code that "DOES NOT WORK" is nonsense, but It reproduces the problem I am having when I am trying to update the contents of a ScrollView. Can someone please confirm that they can reproduce my problem and and if it is a bug or not. 

    KendoUI version: 2012.3.1315
    Platform: Phonegap 2.2.0 on Android 2.2 API (running on Android 4.2 Phone). 

    Cheers,
    Vaughn
  2. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 24 Jan 2013 Link to this post

    Hi,

    By calling:

    $("#scrollview").kendoMobileScrollView().data("kendoMobileScrollView").content("<!--" + content + "-->");

    You re-initialise the widget, which is not supported. 

    The correct approach for subsequent calls would be:

    $("#scrollview").data("kendoMobileScrollView").content("<!--" + content + "-->");

     

    All the best,
    Petyo
    the Telerik team
    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. Vaughn
    Vaughn avatar
    9 posts
    Member since:
    Nov 2012

    Posted 24 Jan 2013 Link to this post

    Thanks Petyo. That was exactly my problem.
Back to Top