dataSource.add() on Kendo Mobile?

2 posts, 0 answers
  1. Marcus
    Marcus avatar
    29 posts
    Member since:
    Jul 2012

    Posted 19 Nov 2013 Link to this post

    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

  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 19 Nov 2013 Link to this post

    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.
Back to Top