This is a migrated thread and some comments may be shown as answers.

Need help MVVM ListView

2 Answers 8 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
perico
Top achievements
Rank 1
perico asked on 29 Nov 2016, 05:52 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 30 Nov 2016, 12:58 PM
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.

 
0
perico
Top achievements
Rank 1
answered on 30 Nov 2016, 02:12 PM
Thank you, it's perfect.
Tags
General Discussion
Asked by
perico
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
perico
Top achievements
Rank 1
Share this question
or