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

Initialize from array

1 Answer 146 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Jonas
Top achievements
Rank 1
Jonas asked on 13 Oct 2012, 04:47 PM
Hi, what am I missing? I'm trying to initialize a datasource with a simple array as data, just like in the documentation http://docs.kendoui.com/api/framework/datasource#methods
. But I cannot get it working.

    var orders = [ { orderId: 10248, customerName: "Paul Smith" }, { orderId: 10249, customerName: "Jane Jones" }];
var dataSource = new kendo.data.DataSource({
     data: orders
});
     
   var order = dataSource.at(0);
     
   if (typeof(order)=="undefined") {
       alert("fail");
   } else {
       alert(order.customerName);
   };


http://jsfiddle.net/HB8NZ/

thanks

1 Answer, 1 is accepted

Sort by
0
Jonas
Top achievements
Rank 1
answered on 13 Oct 2012, 06:30 PM
ah, I need to call .read()
http://jsfiddle.net/HB8NZ/1/
 
Tags
Data Source
Asked by
Jonas
Top achievements
Rank 1
Answers by
Jonas
Top achievements
Rank 1
Share this question
or