I'm trying to render a grid using dgrid. When I try it throws an error when trying to create the columns. I've followed the example exactly so I can't figure out what's wrong. Any help is appreciated.
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);
}
Attempt with 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');
}
There was an interference with another package that I was pulling in causing the type of grid to be incorrect.