<script type="text/javascript"> $(function () { $("#Grid").ejGrid({ dataSource: ej.DataManager(window.employeeView).executeLocal(ej.Query().take(9)), detailsTemplate: "#tabGridContents", detailsDataBound: "detailGridData", . . . .. }); }); function detailGridData(e) { var filteredData = e.data["EmployeeID"]; var data = ej.DataManager(window.ordersView).executeLocal(ej.Query().where("EmployeeID", "equal", parseInt(filteredData), true)); e.detailsElement.find("#detailGrid").ejGrid({ . . .. });
e.detailsElement.css("display", ""); e.detailsElement.find("#detailChart" + filteredData).ejChart( {
. . . . . }); e.detailsElement.find("#btnEdit").ejButton({ showRoundedCorner: true, size: "small", click: function (args) { var obj = $("#Grid").ejGrid("instance"); . .. . . } }); e.detailsElement.find(".tabcontrol").ejTab({ selectedItemIndex: 1, }); } |
<script id="tabGridContents" type="text/x-jsrender"> <div class="tabcontrol" id="Test"> <ul> <li><a rel='nofollow' href="#detailChart{{:EmployeeID}}">Stock Chart</a></li> <li><a rel='nofollow' href="#gridTab{{:EmployeeID}}">Stock Grid</a></li> <li><a rel='nofollow' href="#detailTab{{:EmployeeID}}">Details</a></li> </ul> <div id="detailChart{{:EmployeeID}}"> </div> <div id="gridTab{{:EmployeeID}}"> <div id="detailGrid{{:EmployeeID}}"> </div> </div> <div id="detailTab{{:EmployeeID}}"> <table class="CardTable" cellpadding="3" cellspacing="2"> . . . </table> </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).executeLocal(ej.Query().take(9)), detailsTemplate: "#tabGridContents", detailsDataBound: "detailGridData", columns: [ { field: "EmployeeID", isPrimaryKey: true }, . .. . ] }); }); 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" + filteredData).ejGrid({ . . . . });
e.detailsElement.css("display", ""); e.detailsElement.find("#detailChart" + filteredData).ejChart( { . .. .. }); e.detailsElement.find("#btnEdit").attr("data-id", filteredData).ejButton({ showRoundedCorner: true, size: "small", click: function (args) { var obj = $("#Grid").ejGrid("instance");//Parent Grid var fieldName= obj.getPrimaryKeyFieldNames()[0]; var primaryKeyValue = this.element.data("id");// Value of Primarykey from button attr data-id . . . .. … . . } }); e.detailsElement.find(".tabcontrol").ejTab({ selectedItemIndex: 1, }); } |
e.detailsElement.find("#btnEdit").attr("data-id", filteredData).ejButton({ showRoundedCorner: true, size: "small", click: function (args) { var obj = $("#Grid").ejGrid("instance");//Parent Grid var primaryKeyValue = this.element.data("id"); var index = this.element.closest("tr.e-detailrow").prev().index(); obj.startEdit($(obj.getRows()[index]));//editng fetched data } |
<script id="tabGridContents" type="text/x-jsrender"> <div class="tabcontrol" id="Test"> . . . .. . <div id="detailChart{{:EmployeeID}}"> </div> <div id="gridTab{{:EmployeeID}}"> <div id="detailGrid{{:EmployeeID}}"> </div> </div> . . . … </div> </script>
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" + filteredData).ejGrid({//Done necessary changes in the detailGridData. . . . . }); . . . . .. . } |