1
代碼來創建網格:爲什麼Kendo UI網格中的列菜單會導致錯誤?
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
看到錯誤的示範,在http://jsfiddle.net/lhoeppner/sNdVR/