创建网格的代码:
var grid = $("#grid").kendoGrid({
dataSource: [],
columnMenu: true,
scrollable: true,
sortable: false,
filterable: true,
groupable: true,
columns: [{
field: "Id",
title: "Id",
filterable: false
}, {
field: "title",
title: "Title"
}]
}).data("kendoGrid");
我也以这种方式自定义了 Array 的原型:
Function.prototype.method = function (name, func) {
"use strict";
if (!this.prototype[name]) {
this.prototype[name] = func;
return this;
}
};
Array.method('contains', function (object) {
return $.inArray(object, this) !== -1;
});
结果:每当我尝试打开任何列的列菜单时,我都会得到:
Uncaught TypeError: Cannot call method 'replace' of undefined