我正在尝试使用 KendoUI 自动完成功能,但它给了我错误:
未捕获的类型错误:无法读取未定义的属性“长度”
这是我的javascript:
$("#toppersearch").kendoAutoComplete({
minLength: 1,
dataTextField: "name",
dataSource: new kendo.data.DataSource({
transport: {
read: "Search/search/"+query,
},
schema: {
data: "data"
},
serverFiltering: true,
serverPaging: true,
pageSize: 20
}),
placeholder: "Find a cake topper...",
dataBound: function(e) {
alert(e);
}
});
我的测试返回数据:
require Ms.'SearchModel.php' ;
class Search extends Controller {
public $query ;
private $model ;
function __construct($query)
{
parent::__construct() ;
$this->model = new SearchModel ;
$this->query = $query ;
$this->search() ;
}
public function search()
{
echo '{data:[{0:1,name:Horse}]}' ;
}
}
我究竟做错了什么?