|
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<div id="Grid"></div>
</div>
</div>
</div>
<script id="tabGridContents" type="text/x-jsrender">
<div class="tabcontrol" id="Test">
<ul>
<li><a rel='nofollow' href="#gridTab{{:EmployeeID}}">Stock Grid</a></li>
</ul>
<div id="gridTab{{:EmployeeID}}">
<div id="detailGrid">
</div>
</div>
</div>
</script>
<script type="text/javascript">
$(function () {
$("#Grid").ejGrid({
// the datasource "window.employeeView" is referred from jsondata.min.js
dataSource: ej.DataManager(window.employeeView),
detailsTemplate: "#tabGridContents",
detailsDataBound: "detailGridData",
---
columns: [
----
],
actionComplete: function(args){ // actionComplete event of parent grid.
if(args.requestType == "save"){
var trElement = this.getRowByIndex(args.selectedRow);
this.expandCollapse($(trElement).find('td.e-detailrowcollapse > div')); // expand the newly added row in parent Grid
}
}
});
});
function detailGridData(e) {
var filteredData = e.data["EmployeeID"];
// the datasource "window.ordersView" is referred from jsondata.min.js
var data = ej.DataManager(window.ordersView).executeLocal(ej.Query().where("EmployeeID", "equal", parseInt(filteredData), true));
e.detailsElement.find("#detailGrid").ejGrid({
dataSource: data,
--
columns: [
---
]
});
e.detailsElement.find(".tabcontrol").ejTab({ selectedItemIndex: 1 });
}
</script>
|