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

shared remote json datasource?

2 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 28 Oct 2015, 10:27 PM

Say i have three kendoDropDownList's.  Each should populate their list using a different part of the response from a single remote json datasource.  So say the datasource is this json object:

{
   "somefield1":"someval",
   "somefield2":"someval2",
   "vendors":{  
      "vendor":[  
         {  
            "vendorName":"kroger",
            "vendorID":251
         },
         {  
            "vendorName":"publix",
            "vendorID":262
         }
      ]
   },
   "drivers":{  
      "driver":[  
         {  
            "firstName":"bob",
            "driverID":12,
         },
         {  
            "firstName":"bill",
            "driverID":15,
         }
   },
   "users":{  
      "user":[  
         {  
            "username":"charlie",
            "employeeid":11
         },
         {  
            "username":"linda",
            "employeeid":2
         }
      ]
   }
}

How would I ​get the first kendoDropDownList to bind to vendors, the second to drivers, and the third to users, without having to hammer the server with three separate requests?

 

 

2 Answers, 1 is accepted

Sort by
0
Ryan
Top achievements
Rank 1
answered on 29 Oct 2015, 05:44 PM

I guess what I am wondering is, can you do something like this in the kendoDropDownList config:

dataSource: sharedDataSource,

dataTextField: "vendors.vendor.vendorName",

dataValueField: "vendors.vendor.vendorID"​

0
Kiril Nikolov
Telerik team
answered on 30 Oct 2015, 09:49 AM

Hello Ryan,

 

The Kendo UI DataSource cannot have different schema for the different widgets. This is why I would suggest you to fetch the data from the remote services and then set each data set to the particular widgets.

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Ryan
Top achievements
Rank 1
Answers by
Ryan
Top achievements
Rank 1
Kiril Nikolov
Telerik team
Share this question
or