Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepowershell
  function myDS() {

            var serviceUrl = "_vti_bin/listdata.svc/MyList?$select=Title";
            var dataSource = new kendo.data.DataSource({
            type: "odata",
              transport: {
                read:  {
                  url: serviceUrl,
                  dataType: "json" 
                },
              },
              schema: {
                model: { 
                        Id: "Id",
                        fields: {
                             Title: { type: "string" }
                    }
                }
              },
                error: function (e) {
                    var response = JSON.parse(e.responseText);
                    alert(response.error.message.value);
                }
             });
        return dataSource;
    }
 
/* The following update worked well */
var locationOdataUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('Locations')/items?$select=Id,Full_x0020_Location&$orderby=Title,Postcode";
 $("#locationSelector").kendoDropDownList({
                        dataTextField: "Full_x0020_Location",
                        dataValueField: "Id",
                        autoBind: false,
                        dataSource: {
                            type: "odata",
                            transport: {
                                read: {
                                    url: locationOdataUrl,
                                    beforeSend: function (xhr) { xhr.setRequestHeader('accept', 'application/json;odata=verbose'); },
                                    dataType: "json"
                                }
                            },
                            schema: {
                                model: {
                                    Id: "Id",
                                    fields: {
                                        Title: { type: "string" }
                                    }
                                }
                            }
                        },
                        index: 0,
                        change: onChange
                    });
 
 

 

However, this was still problematic.  In some cases I reverted to a standard jQuery.ajax call.

...