0

A second set of eyes will help. I have a JSON string I'm reading from a RESTFUL endpoint. I want to declare the datasource separately "var dataSourceGLDes" and bind different DropDownLists to the data source. I'm getting an undefined result for the following:

GLDes: [{"gldes":"Comm "},{"gldes":"Indus "},{"gldes":"Auth "},{"gldes":"Res "},{"gldesc":"Whole "}]

$("#cboSearchString1DDL").kendoDropDownList({
                               autoBind: false,
                               dataTextField: "gldes",
                               dataValueField: "gldes",
                               dataSource: dataSourceGLDes,                                                                     
                           }).data("kendoDropDownList");

var dataSourceGLDes = new kendo.data.DataSource({
                   serverFiltering: true,
                   transport: {                          
                       read: {
                           url: _urlSOEResources,
                           dataType: "json"
                       }
                   },
                   schema: {
                       data: "GLDes"
                   }
               });
               dataSourceGLDes.read();
ripsin
  • 273
  • 2
  • 7
  • 19

1 Answers1

0

What you shared seems to be working fine, just the order of declaring the dataSource and the kendo Grid looks wrong.

Here is live example that you can try (just switched the read operation to be function to simulate server call, rest is the same)

  <input type="text" id="cboSearchString1DDL">
  <script>

    var t  = {GLDes: [{"gldes":"Comm "},{"gldes":"Indus "},{"gldes":"Auth "},{"gldes":"Res "},{"gldesc":"Whole "}]}



var dataSourceGLDes = new kendo.data.DataSource({
                   serverFiltering: true,
                   transport: {                          
                     read: function(options){
                       options.success(t);
                     }
                   },
                   schema: {
                       data: "GLDes"
                   }
               });
               dataSourceGLDes.read();

  $("#cboSearchString1DDL").kendoDropDownList({
                               autoBind: false,
                               dataTextField: "gldes",
                               dataValueField: "gldes",
                               dataSource: dataSourceGLDes,                                                                     
                           }).data("kendoDropDownList");
Petur Subev
  • 19,983
  • 3
  • 52
  • 68
  • I was a slacker when posting the order and the data. The order I had correct, however, the data was an html view of my json string which is properly escaped. So I still have the issue. `"GLDes": "[{\"gldes\":\"Comm\"},{\"gldes\":\"Indus\"},...]", – ripsin Nov 14 '13 at 23:17