Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
143827 | Apr 6,2019 02:26 PM UTC | Apr 9,2019 11:56 AM UTC | ASP.NET MVC - EJ 2 | 3 |
![]() |
Tags: Grid |
<div>
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.datasource)...ActionBegin("ActionBegin").ActionComplete("ActionComplete")...Render()
</div>
<script type="text/javascript">
var collapsedGroupindex = [];
function ActionBegin(args) {
if (args.requestType == "delete" || (args.requestType == "save" && args.action == "add")) { //Check for this condition to make action perform only during delete and add
var collapsedrows = document.getElementsByClassName("e-recordpluscollapse");
for (var i = 0; i < collapsedrows.length; i++) {
collapsedGroupindex.push(document.getElementsByClassName("e-recordpluscollapse")[i].getAttribute("ej-mappingvalue")); //push the mapping value of the collapsed rows in a variable.
}
}
}
function ActionComplete(args) {
if (args.requestType == "delete" || (args.requestType == "save" && args.action == "add")) { //Check for this condition to make action perform only during delete and add
setTimeout(function () {
var gridObj = document.getElementById("Grid").ej2_instances[0]; //Get Instance for Grid
for (var i = 0; i < collapsedGroupindex.length; i++) {
gridObj.groupModule.expandCollapseRows(document.querySelectorAll("td[ej-mappingvalue='" + collapsedGroupindex[i] + "']")[0]); //Call the “expandCollapseRows” with the corresponding row index td(selected based on mapping value) element.
}
collapsedGroupindex = [];
}.bind(collapsedGroupindex), 1);
}
}
</script>
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.