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

dataSource.add() on Kendo Mobile?

1 Answer 40 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marcus
Top achievements
Rank 2
Marcus asked on 19 Nov 2013, 10:44 AM
Hi,

i am Using Icenium with kendo.mobile.min.js , jquery.min.js

i am trying to add some data to my datasource.

Let's assume i am in a for loop and every time i go through the loop i want to add some data to my dataSource.

--
var datasource = [ ];

for (var k = 0; k < subjson.length; k++) {
                                                         for (key in subjson[k]) {
                                                             if (subjson[k].hasOwnProperty(key)) {
                                                                 if (key == "name") {
                                                                     var arraycount = array + 1;
                                                                     output = subjson[k][key]


                                                             }  
                                                             // retrieve other keys, like link, image, etc.
                                                         }
                                                     }


I tried to use

dataSource.add({ 
name: output });

However i am not getting any luck, since it's always throwing

Object [object Array] has no method 'add'

Any ideas?

Rgds

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 19 Nov 2013, 03:05 PM
Hello Marcus,

Javascript arrays do not have add method and therefore the error is expected. If you intended to use the Kendo UI DataSource, then the datasource variable should be declared as  var dataSource= new kendo.data.DataSource();

Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
Tags
General Discussions
Asked by
Marcus
Top achievements
Rank 2
Answers by
Steve
Telerik team
Share this question
or