Hello all,
I am struggling with the best way to model collection properties for a kendo.data.Model used in a kendo.data.DataSource, and configure it is such a way that data-bind attributes understand. For example, say my view model looks like this:
As you can see, the Invoices property is an array - a collection of invoices. How do I get the DataSource to understand this, and how would I bind Invoices to the view? Would this work?
What if I wanted to represent this collection of Invoices as a kendoGrid which I could add, edit, and delete from? Is this functionality supported out-of-the-box or will I need to create a separate Invoice DataSource?
Thanks for any assistance you can provide.
I am struggling with the best way to model collection properties for a kendo.data.Model used in a kendo.data.DataSource, and configure it is such a way that data-bind attributes understand. For example, say my view model looks like this:
var
entityModel = kendo.data.Model.define({
id:
'Id'
,
fields: {
Id: { editable:
false
, defaultValue:
'00000000'
},
Name: {},
Created: { type:
'date'
},
Contract: {
StartDate: { type:
'date'
},
EndDate: { type:
'date'
},
Received: { type:
'date'
}
},
Vendor: {
Name: {},
Street: {},
City: {},
State: {},
Zip: {},
Phone: {},
Email: {}
},
Invoices: []
}
});
var
entityDataSource =
new
kendo.data.DataSource({
schema: {
model: entityModel
},
transport: {
...
}
});
As you can see, the Invoices property is an array - a collection of invoices. How do I get the DataSource to understand this, and how would I bind Invoices to the view? Would this work?
<
div
data-template
=
"invoiceTemplate"
data-bind
=
"source: Invoices"
></
div
>
Thanks for any assistance you can provide.