KendoUI Grid无法使用RequireJS

时间:2015-03-07 19:49:08

标签: javascript jquery kendo-ui requirejs kendo-grid

我有:

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");
})

但是在线上有:     activeGrid.kendoGrid({

我收到错误:

Uncaught TypeError: undefined is not a function

知道如何解决这个问题吗?在过去的四个小时里,它让我发疯了......

0 个答案:

没有答案