Вопрос

Trying to display "COLUMN_NAME" text in combobox. Here is the successful '200' response with parsed string from the browser:

[{"COLUMN_NAME":"Account","DATA_TYPE":"char"},"COLUMN_NAME":"Address","DATA_TYPE":"char"},...}]

Here is my js:

var dataSourceCustomers = new kendo.data.DataSource({
    transport: {
        read: {
            url: "http://127.0.0.2:6080/arcgis/rest/services/Wks/WW/MapServer/exts/RestSOE/Search%20Parameters?searchType=CUSTOMER&f=",
            dataType: "jsonp",
            type: 'GET'
        }
    },
    schema: {
        data: ["COLUMN_NAME","DATA_TYPE"],
    }
});

dataSourceCustomers.read();

The combobox however is blank. Thanks in advance!

Это было полезно?

Решение

The problem is the definition of schema.data that you define it as an array and this is not supported. In addition and according with you example of JSON you don't need it.

And in the ComboBox you define where on each item of the array is where you have the field for the Combo.

It should be like:

var dataSourceCustomers = new kendo.data.DataSource({
    transport: {
        read: {
            url: "http://127.0.0.2:6080/arcgis/rest/services/Wks/WW/MapServer/exts/RestSOE/Search%20Parameters?searchType=CUSTOMER&f=",
            dataType: "jsonp",
            type    : 'GET'
        }
    }
});

$("#combo").kendoComboBox({
    dataSource   : dataSourceCustomers,
    dataTextField: "COLUMN_NAME"
})

BTW: Your example looks like JSON and not JSONP. Is it JSONP?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top