Order Number 4004 | 9 Items in Order | Order Total: $125 | |
Line 1: 4 "A" widgets at $25/each | Line Total: $100 | ||
Line 2: 5 "B" widgets at $5/each | Line Total: $25 |
Order Number 4004 | 10 Items in Order | Order Total: $150 | |
Line 1: 5 "A" widgets at $25/each | Line Total: $125 | ||
Line 2: 5 "B" widgets at $5/each | Line Total: $25 |
@(Html.EJ().Grid<EmployeeView>("HierarchyGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
. . .
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("Items").Width(100).Add();
col.Field("Total").Width(120).Add();
})
.ChildGrid(child =>
{
. . .
.ClientSideEvents(e=> e.ActionComplete("onActionComplete"))
.Columns(col =>
{
col.Field("Line_No").HeaderText("Line No").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("Line_Item").HeaderText("Line Item").Width(100).Add();
col.Field("Line_Total").Width(120).Add();
});
})
)
<script type="text/javascript">
function onActionComplete(args) {
if (args.requestType == "save") {
var itemSum = ej.sum(this.model.currentViewData, "Line_Item"), totalSum = ej.sum(this.model.currentViewData, "Line_Total");
var parentGridObj = $("#HierarchyGrid").ejGrid("instance"), obj = {};
obj = { OrderID: this.model.currentViewData[0].OrderID, Items: itemSum, Total: totalSum };
parentGridObj.collapseAll();
parentGridObj.updateRecord("OrderID", obj);
}
}
</script>
|
@(Html.EJ().Grid<EmployeeView>("HierarchyGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
. . .
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("Items").Width(100).Add();
col.Field("Total").Width(120).Add();
})
.ChildGrid(child =>
{
. . .
.ClientSideEvents(e=> e.ActionComplete("onActionComplete"))
.Columns(col =>
{
col.Field("Line_No").HeaderText("Line No").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("Line_Item").HeaderText("Line Item").Width(100).Add();
col.Field("Line_Total").Width(120).Add();
});
})
)
<script type="text/javascript">
function onActionComplete(args) {
if (args.requestType == "save") {
var itemSum = ej.sum(this.model.currentViewData, "Line_Item"), totalSum = ej.sum(this.model.currentViewData, "Line_Total");
var parentGridObj = $("#HierarchyGrid").ejGrid("instance"), obj = {};
obj = { OrderID: this.model.currentViewData[0].OrderID, Items: itemSum, Total: totalSum };
parentGridObj.collapseAll();
parentGridObj.updateRecord("OrderID", obj);
}
}
</script>
|