skip to Main Content

so i have this simple object

var dataSource = new kendo.data.DataSource({
       data : ["One", "Two"]
    });
    console.log(dataSource.data[0]);

    kendo.bind($("#container3"), {});

im trying to get the value of "One" or "Two" but i always get undefined.

console.log(dataSource.data[0]);

2

Answers


  1. use

    dataSource.transport.data[0]
    

    instead of

     dataSource.data[0] 
    
    Login or Signup to reply.
  2. You should use the data method to get the dataItems of the dataSource. Keep in mind the method will return an empty array if the dataSource is not populated with items via a call of either the fetch, read or query methods:

     var dataSource = new kendo.data.DataSource({
        data : ["One", "Two"]
      });
    
      dataSource.fetch(function(){
        console.log(dataSource.data()[0]);
      })
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search