Need help MVVM ListView

Thread is closed for posting
3 posts, 1 answers
  1. perico
    perico avatar
    28 posts
    Member since:
    Dec 2006

    Posted 29 Nov 2016 Link to this post

    Hi,

    I have a ListView

    <div class="mybackground" id="applicationList" data-role="view" data-title="Page principale" data-layout="main" data-model="app.applicationList" data-show="app.applicationList.onShow" data-after-show="app.applicationList.afterShow">
     
        <section id="conteneur">
     
            <div>
                <ul data-role="listview" data-bind="source: source"></ul>
            </div>
     
        </section>
     
    </div>

     

    If i set my datasource like this, it works perfectly

    app.applicationList = kendo.observable({
        source: ["Table", "Sofa"],
        onShow: function () { },
        afterShow: function () { }
    });

     

    But if i create an array 

    var = applicationList;

     

    And set it programmatically with something like : applicationList = json_obj.appList;

    with  source: applicationList

    It doesn't work anymore.

    I think that the listView doesn't refresh when my var is set.

     

    Thank you for your help.

     

  2. Answer
    Tsvetina
    Admin
    Tsvetina avatar
    2323 posts

    Posted 30 Nov 2016 Link to this post

    Hello Perico,

    You need to use the set method of the model to notify it of the source change, as advised here:
    Set Field Values

    You can browse through the entire article content as it provides useful information on working with Kendo Observable objects (models).

    Regards,
    Tsvetina
    Telerik by Progress
     

    Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

     
  3. perico
    perico avatar
    28 posts
    Member since:
    Dec 2006

    Posted 30 Nov 2016 in reply to Tsvetina Link to this post

    Thank you, it's perfect.
Back to Top