Javascript KendoUI网格不与RequireJS一起工作
我有:Javascript KendoUI网格不与RequireJS一起工作,javascript,jquery,kendo-ui,requirejs,kendo-grid,Javascript,Jquery,Kendo Ui,Requirejs,Kendo Grid,我有: 你知道我该怎么解决这个问题吗?在过去的四个小时里,它一直让我抓狂……这个错误在哪一行?需要配置吗?“activeGrid”的定义在哪里?看一看,@LarsHöppner很抱歉我漏掉了,请看我的编辑(第二行代码)。@CoryDanielson以“activeGrid.kendoGrid({”)开头的那一行。就像kendoGrid不存在一样。 require(['jquery', 'kendo'], function($, kendo){ var activeGrid = $('#incom
你知道我该怎么解决这个问题吗?在过去的四个小时里,它一直让我抓狂……这个错误在哪一行?需要配置吗?“activeGrid”的定义在哪里?看一看,@LarsHöppner很抱歉我漏掉了,请看我的编辑(第二行代码)。@CoryDanielson以“activeGrid.kendoGrid({”)开头的那一行。就像kendoGrid不存在一样。
require(['jquery', 'kendo'], function($, kendo){
var activeGrid = $('#incomeGrid');
var incomeSource = new kendo.data.DataSource({
sort: {
field: "date",
dir: "desc"
},
batch: true,
transport: {
read: {
url: 'core/income-grid/read',
dataType: 'json',
type: 'get'
},
update: {
url: 'core/income-grid/update',
dataType: 'json',
type: 'post'
},
create: {
url: 'core/income-grid/create/',
dataType: 'json',
type: 'post'
},
destroy: {
url: 'core/income-grid/destroy/',
dataType: 'json',
type: 'post'
}
},
error: function (e) {
alert(e.errorThrown + "\n" + e.status + "\n" + e.xhr.responseText);
},
schema: {
data: "data",
total: 'total',
model: {
id: 'id',
fields: {
typeId: {
type: 'number'
}
}
}
},
change: function (e) {
if (e.action == "itemchange" || e.action == "remove") {
if (!activeGrid.ctrlDown) {
this.sync();
}
}
}
});
activeGrid.kendoGrid({
dataSource: incomeSource,
autoBind: true,
height: 152,
pageable: false,
filterable: false,
toolbar: kendo.template($("#incomeToolBar").html()),
edit: function (e) {
var ddl = e.container.find('[data-role=dropdownlist]').data('kendoDropDownList');
if (ddl) {
ddl.open();
}
},
columns: [
{
title: 'Date added',
field: 'date',
width: '90px',
filterable: false,
template: '<span data-id="#=id#"><abbr title="">#=kendo.toString(date, "dd/MM/yyyy")#</abbr></span>'
}
],
editable: true,
sortable: true,
scrollable: true
}).data("kendoGrid");
})
Uncaught TypeError: undefined is not a function