<ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowPaging="True"> <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings> <ToolbarSettings ShowToolbar="True"> <CustomToolbarItem> <ej:CustomToolbarItem TemplateID="#DeleteAll" /> </CustomToolbarItem> . . . . </ToolbarSettings> <ClientSideEvents ToolbarClick="onToolBarClick" /> </ej:Grid> <script> function onToolBarClick(args) { if (args.itemName == "DeleteAll") this.dataSource([]); }; </script> <script id="DeleteAll" type="text/x-jsrender"> <a class="e-toolbaricons DeleteAll" /> </script> <style type="text/css" class="cssStyles"> .DeleteAll:hover { background-image: url("../Content/ej/web/common-images/ribbon/Check.png;"); } |
<ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowPaging="True"> <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True"></EditSettings> <ClientSideEvents ContextClick="conClick"/> . .. . </ej:Grid> <script> function conClick(args) { if(args.text=="DeletesRow") this.deleteRecord("OrderID",this.model.selectedRecords[0]); }; </script> |
1) Are you using a ejGrid (Javascript) or ASP Grid ?
2) Code example of Grid
3) Please provide more information about your requirement.
Regards,
Seeni Sakthi Kumar S.
<div id="Grid"></div> <script id="GridContents" type="text/"> <div id="gridTab{{:EmployeeID}}"> <div id="detailGrid{{:EmployeeID}}"> </div> </div> </script> <script type="text/javascript"> $(function () { $("#Grid").ejGrid({ dataSource: ej.DataManager(window.employeeView), detailsTemplate: "#GridContents", 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" + filteredData).ejGrid({ dataSource: data, selectionType: "multiple", toolbarClick: function (args) { if (args.itemName == "Delete") { var records = this.model.selectedRecords; for (var del = 0; del < records.length; del++) { this.deleteRecord("OrderID", records[del]); } args.cancel = true; } }, . . . . . . columns: [ . . . . . ] }); } |
<div id="Grid"></div> <script id="GridContents" type="text/"> <div id="gridTab{{:EmployeeID}}"> <div id="detailGrid{{:EmployeeID}}"> </div> </div> </script> <script type="text/javascript"> $(function () { $("#Grid").ejGrid({ dataSource: ej.DataManager(window.employeeView), detailsTemplate: "#GridContents", 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" + filteredData).ejGrid({ dataSource: data, selectionType: "multiple", contextMenuSettings: { enableContextMenu: true, contextMenuItems: [], customContextMenuItems: ['DeleteRow'] }, contextClick: function (args) { if (args.text == "DeleteRow") this.deleteRecord("OrderID", this.model.selectedRecords[0]); }, editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true }, columns: [ . . . . . . ] }); } |