[grid.html] <template> <div> <ej-grid id="Grid" e-data-source.bind="dataSource" e-edit-settings="editSettings" e-toolbar-settings="toolbarSettings" e-details-template="#tabGridContents" // detail template defining e-on-details-data-bound.delegate="eventdatabound($event.detail)" > //detaildata =bound event defining <ej-column e-field="OrderID" e-is-primary-key="true" ></ej-column> <ej-column e-field="EmployeeID" ></ej-column> <ej-column e-field="CustomerID" ></ej-column> </ej-grid> <div id="tabGridContents"> // template <div id="detailGrid"></div> </div> </div> </template> |
[grid.js] export class Grid { constructor() { this.dataSource = dataSource; ------------------- } eventdatabound(e){ var collectionData = e.data['ShipDetails']; // Get the dataSource for ShipDetails e.detailsElement.find("#detailGrid").ejGrid({ // detail template Grid rendering dataSource: collectionData, allowSelection: false, --------------- columns: [ ------------ ] }); } } |
var dataSource = [{ OrderID: 10280, CustomerID: "BERGS", EmployeeID: 2, ShipDetails:[{ShipName:"Berglunds snabbköp", ShipCity: "Luleå", ShipCountry: "Sweden",}], }, { OrderID: 10265, CustomerID: "BLONP", EmployeeID: 2, ShipDetails: [{ShipName:"Blondel père et fils", ShipCity: "Strasbourg",ShipCountry:"France"}] }] |