Kendo UI DataSource打破了ajax调用" this.substr不是一个函数"

时间:2016-10-15 00:15:43

标签: kendo-ui kendo-combobox

我收到错误:

Uncaught TypeError: this.substr is not a function
String.remove   @   vendor?v=aDfyqYhlmP6LIh14D-zVAUS28dc7bUxpraoGG0oruGc1:formatted:25867
e               @   vendor?v=aDfyqYhlmP6LIh14D-zVAUS28dc7bUxpraoGG0oruGc1:formatted:3465
ci              @   vendor?v=aDfyqYhlmP6LIh14D-zVAUS28dc7bUxpraoGG0oruGc1:formatted:249
i.param         @   vendor?v=aDfyqYhlmP6LIh14D-zVAUS28dc7bUxpraoGG0oruGc1:formatted:3475
ajax            @   vendor?v=aDfyqYhlmP6LIh14D-zVAUS28dc7bUxpraoGG0oruGc1:formatted:3668
read            @   kendo.all.min.js:11
(anonymous function)    @   kendo.all.min.js:11
_queueRequest   @   kendo.all.min.js:11
read            @   kendo.all.min.j

我意识到这不是非常有帮助的。这就是传输对象的样子:

var dataSource = {
    transport: {
        read: {
            type: 'POST',
            url: ajaxUrlFn(), //returns string
            dataType: 'application/json; charset=UTF-8',
            data: self.searchJson(), //returns string
        },
        schema: {
            data: function (response) {
                //code stuff...
            },
        },
    },
};

这会点击read对象然后中断。

1 个答案:

答案 0 :(得分:0)

似乎transport.read.data属性期望对象类型而不是字符串类型。

var dataSource = {
    transport: {
        read: {
            type: 'POST',
            url: ajaxUrlFn(), //returns string
            dataType: 'application/json; charset=UTF-8',
----------->data: self.searchObject() //returns an object <-----------
        },
        schema: {
            data: function (response) {
                //code stuff...
            },
        },
    },
};