dgrid '对象不支持这个动作;尝试呈现列时
dgrid 'Object doesn't support this action; when attempting to render columns
我正在尝试使用 dgrid 渲染网格。当我尝试创建列时它会抛出错误。我完全按照这个例子做了,所以我不知道出了什么问题。感谢任何帮助。
require(["dojo", "dojo/dom", "dojo/_base/array", "dijit/registry", "dojo/store/Memory", "dgrid/Grid", "dojo/domReady!"],
function (array, Grid, dom, dojo, registry, Memory, On) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://localhost:5944/Home/GetData", true);
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
data = JSON.parse(xmlhttp.responseText);
GridStore = new Memory({ data: data, idProperty: "_id" });
CreateGrid();
}
}
CreateGrid = function () {
var columns = {
_id: { label: "ID" },
_SectionID: { label: "SpecID" },
_name: { label: "Name" },
_number: { label: "Number" },
_description: { label: "Description" },
_url: { label: "URL" }
};
var grid = new Grid({ columns: columns }, 'editGrid');
grid.renderArray(GridStore);
}
尝试使用 OnDemandGrid
CreateGrid = function () {
var grid = new OnDemandGrid({
collection: GridStore,
columns: [
{ field: "_id", label: "ID" },
{ field: "_SectionID", label: "SpecID" },
{ field: "_name", label: "Name" },
{ field: "_number", label: "Number" },
{ field: "_description", label: "Description" },
{ field: "_url", label: "URL" }
]
}, 'editGrid');
}
我正在尝试使用 dgrid 渲染网格。当我尝试创建列时它会抛出错误。我完全按照这个例子做了,所以我不知道出了什么问题。感谢任何帮助。
require(["dojo", "dojo/dom", "dojo/_base/array", "dijit/registry", "dojo/store/Memory", "dgrid/Grid", "dojo/domReady!"],
function (array, Grid, dom, dojo, registry, Memory, On) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "http://localhost:5944/Home/GetData", true);
xmlhttp.send();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
data = JSON.parse(xmlhttp.responseText);
GridStore = new Memory({ data: data, idProperty: "_id" });
CreateGrid();
}
}
CreateGrid = function () {
var columns = {
_id: { label: "ID" },
_SectionID: { label: "SpecID" },
_name: { label: "Name" },
_number: { label: "Number" },
_description: { label: "Description" },
_url: { label: "URL" }
};
var grid = new Grid({ columns: columns }, 'editGrid');
grid.renderArray(GridStore);
}
尝试使用 OnDemandGrid
CreateGrid = function () {
var grid = new OnDemandGrid({
collection: GridStore,
columns: [
{ field: "_id", label: "ID" },
{ field: "_SectionID", label: "SpecID" },
{ field: "_name", label: "Name" },
{ field: "_number", label: "Number" },
{ field: "_description", label: "Description" },
{ field: "_url", label: "URL" }
]
}, 'editGrid');
}