@(Html.EJ().Grid<object>("FlatGrid")
.Datasource((IEnumerable<object>)ViewBag.datasource)
.AllowPaging()
.DetailsTemplate("#tabGridContents")
.ClientSideEvents(eve => { eve.DetailsDataBound("detailGridData"); })
.Columns(col =>
{
col.Field("EmployeeID").HeaderText("Employee ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
-----
}))
<script id="tabGridContents" type="text/x-jsrender">
<div class="tabcontrol">
<div>
<div id="detailGrid">
</div><br />
<div id="seconddetailGrid">
</div>
</div>
</div>
</script>
<script type="text/javascript">
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,
allowSelection: false,
columns: [
-----
]
});
e.detailsElement.find("#seconddetailGrid").ejGrid({
dataSource: data,
allowSelection: false,
columns: [
----
]
});
}
</script>
|
Thanks, it's work.
I've modified a bit on the JS code. The data source is already in the parent table, so it does not have to be filtered.
function detailGridData(e) {