|
<div>
<ejs-grid id="Grid" allowPaging=true load='load'>
<e-datamanager url='http://js.syncfusion.com/demos/ejservices//Wcf/Northwind.svc/Employees/' adaptor="ODataAdaptor" crossdomain="true"></e-datamanager>
<e-grid-columns>
<e-grid-column field="EmployeeID" headerText="Employee ID" width="110"></e-grid-column>
. . . . .
</e-grid-columns>
</ejs-grid>
</div>
<script>
function load(args) {
this.childGrid = {
dataSource: new ej.data.DataManager({
adaptor: new ej.data.ODataAdaptor(),
crossDomain: true
}),
queryString: 'EmployeeID',
allowPaging: true,
pageSettings: {pageSize: 5},
columns: [
{ field: 'OrderID', headerText: 'Order ID', width: 120 },
. . . . .
],
};
}
</script> |
|
|
|
<div class="container">
<ejs-grid id="Grid" dataSource=@ViewBag.DataSource allowPaging=true load="load" dataBound="dataBound">
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" width="110"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" width="110"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
<script>
function dataBound(args) {
document.getElementById("Grid").ej2_instances[0].detailRowModule.expandAll(); // expand child grid at initial rendering
}
</script> |
|
public IActionResult Index()
{
var dataSource = new List<OrdersDetails>() {
new OrdersDetails() { OrderID = 1, CustomerID = "VINET", Details = new List<Details>() {
new Details(){ ShipCountry = "IND", ShipName = "BlackPearl" },
new Details(){ ShipCountry = "BAN", ShipName = "DarkWorld" }
}
},
new OrdersDetails() { OrderID = 2, CustomerID = "VINET", Details = new List<Details>() {
new Details(){ ShipCountry = "IND", ShipName = "BlackPearl" },
new Details(){ ShipCountry = "USA", ShipName = "WhiteField" },
new Details(){ ShipCountry = "FDA", ShipName = "IdeaWorld" }
}
}
};
ViewBag.DataSource = dataSource;
return View();
} |
|
<div class="container">
<ejs-grid id="Grid" dataSource=@ViewBag.DataSource allowPaging=true load="load" dataBound="dataBound">
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" width="110"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" width="110"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div>
<script>
function load(args) {
this.childGrid = {
dataSource: null,
allowPaging: true,
pageSettings: {pageSize: 5},
columns: [
{ field: 'ShipCountry', headerText: 'Ship Country', textAlign: 'Right', width: 120 },
{ field: 'ShipName', headerText: 'Ship Name', width: 150 }
],
created: create
};
}
</script>
<script>
function create() {
this.dataSource = this.parentDetails.parentRowData.Details;
this.query = new ej.data.Query(); // render child grid data
}
</script> |
|
<div class="container">
<ejs-grid id="Grid" dataSource=@ViewBag.DataSource allowPaging=true load="load" toolbar="@(new List<string>() { "Print"})" dataBound="dataBound">
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" width="110"></e-grid-column>
<e-grid-column field="CustomerID" headerText="Customer ID" width="110"></e-grid-column>
</e-grid-columns>
</ejs-grid>
</div> |