[Default.aspx]
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowGrouping="true">
<GroupSettings GroupedColumns="CustomerID" />
<Columns>
…
</Columns>
<ClientSideEvents Create="create" DataBound="databound"/>
</ej:Grid>
<script>
function databound(args) {
var grid = $(".e-grid").ejGrid("instance");
if (args.model.groupSettings.groupedColumns.length)
grid.collapseAll();
}
</script>
</asp:Content>
|
[Default.aspx]
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<ej:NumericTextBox runat="server" ID="textbox" ClientSideOnChange="change"></ej:NumericTextBox>
<ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowGrouping="true">
<GroupSettings GroupedColumns="CustomerID" />
</ej:Grid>
<script>
function change(args) {
var grid = $(".e-grid").ejGrid("instance");
var detailRow =grid.element.find(".e-recordpluscollapse");
grid.expandCollapse($(detailRow[args.value]));
}
</script> |
[Default.aspx]
<ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowGrouping="true">
<EditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" />
<ToolbarSettings ShowToolbar="true" ToolbarItems="add,delete,edit,update,cancel"></ToolbarSettings>
<GroupSettings GroupedColumns="CustomerID" />
<Columns>
… </Columns>
<ClientSideEvents ActionComplete="actioncomplete" DataBound="databound"/>
</ej:Grid>
<script>
var a;
…
function databound(args) {
var grid = $(".e-grid").ejGrid("instance");
if (args.model.groupSettings.groupedColumns.length)
grid.collapseAll();
}
function actioncomplete(args) {
var gridObj = $(".e-grid").ejGrid("instance");
if (args.requestType == "beginedit")
a = args.rowIndex;
if (args.requestType == "save") {
this.selectRows(a);
gridObj.collapseAll();
var currentTr = $(gridObj.getRows()).eq(gridObj.selectedRowsIndexes[0]);
for (i = 0; i < currentTr.parents("tr").length; i++) {
var curEl = currentTr.parents("tr").eq(i).prev().find(".e-recordpluscollapse");
gridObj.expandCollapse(curEl); //Expanded the record and make the edited record to be selected.
}
}
if (args.model.groupSettings.groupedColumns.length && args.requestType == "paging" || args.requestType == "grouping")
gridObj.collapseAll();
} </script>
</asp:Content> |