I am currently attempting to use the Kendo Grid to display data that is returned from my Node/Express/Mongoose/MongoDB stack.
Being that MongoDB is schemaless, I have the scenario where my collection will have documents that may or may not contain the same elements.
When trying to populate a grid with a returned JSON query similar to the following:
[
{FirstName: "TestA", LastName:"TestB", Age: 50},
{FirstName: "TestC", Age:50}
]
Using a grid datasource schema that is dynamically generated similar to:
schema: {
model: {
fields: {
FirstName: { type: "string" },
LastName: { type: "string"},
Age: { type: "number" }
}
}
}
Trying to display three columns:
[
{
field: "FirstName",
title: "First Name"
}, {
field: "LastName",
title: "Last Name"
}, {
field: "Age",
title: "Age"
}
]
I get an error when binding the data. In Firefox and IE it says "LastName is not defined". In Chrome I do not get an error the grid draws the text "[object HTMLCollection]" where you'd expect the field to be null or blank.
Is the grid intended to handle the scenario where an element may not be present in the returned JSON?
If not, are there an work arounds to this?
Thanks in Advance,
Rene