Hi there,
Thanks in advance!
I'm currently building a kando application and I'm wondering about the use of data.model and datasources.
I would like to map My json source to a defined js entity model.
My js model is like that:
var Impianto = kendo.data.Model.define({
id: "IdImpianto", // the identifier of the model
fields: {
"IdImpianto": {
editable: false,
nullable: false,
type: "Number"
},
"RagioneSociale": {
type: "string"
},
"Alias": {
type: "string"
},
"Indirizzo": {
type: "string"
},
"Servizio": {
type: "string"
}
}
});
var dataSource = new kendo.data.DataSource({
schema: {
model: Impianto
}
});
while My json response is something like:
var myDS = [{"Alias":"customer1","IdImpianto":87792,"Indirizzo":"Milano","RagioneSociale":"customer1","Servizio":"MONITORAGGIO"},{"Alias":"customer2","IdImpianto":87793,"Indirizzo":"roma","RagioneSociale":"customer2","Servizio":"PATTUGLIAMENTO"}]
on My jquery ajax success response, I tried to assign json response to My kendo entity model in this way:
var myImpianto = new Impianto();
myImpianto.dataSource = myDS;
By the way the result is that the entity is not filled with any value;
Am I doing something wrong? Is there any way to automatically fill a custom entity with a json source?
Thanks in advance!