|
var curPage
var rowIndex;
// Grid’s actionComplete event handler
function onActionComplete(args) {
// Triggers when the edit action is successfully started
if (args.requestType === "beginEdit") {
// The parent Grid instance is retrieved
var parentGrid = this.element.parentElement.closest('.e-grid').ej2_instances[0];
// The current page of the parent Grid is stored in a global variable
curPage = parentGrid.pageSettings.currentPage;
// The parent row of the expanded child is retrieved
var detailRow = args.row.closest('.e-detailrow');
var curExpandedRow = detailRow.previousElementSibling;
// The parent row index is stored in a global variable
rowIndex = curExpandedRow.getAttribute('aria-rowindex');
}
}
// Event function triggered on navigating back to the Grid after completing edit operation
function onPageNavigate() {
// Parent Grid instance is retrieved using it ‘Id’
var gridObj = document.getElementById('Grid').ej2_instances[0];
// Parent Grid is navigated to the globally stored page index
gridObj.goToPage(2);
// The previously expanded row element is retrieved by passing the stored index to the Grid’s ‘getRowByIndex’ method
var previousRow = gridObj.getRowByIndex(0);
// The parent expand icon is retrieved from the row element
var previousRowExpandIcon = previousRow.querySelector('.e-detailrowcollapse');
// The icon is clicked in order to expand and display the child Grid
previousRowExpandIcon.click();
} |
|
var flag = false;
// Grid’s actionComplete event handler
function onActionComplete(args) {
// Triggers when the edit action is successfully started
if (args.requestType === "beginEdit") {
.
.
// A global flag variable is enabled here to check condition in the dataBound event
flag = true;
}
}
// Grid’s dataBound event handler
function dataBound() {
if (flag) {
// Here the code for restoring the Grid settings can be executed
.
.
// The global flag variable is disabled so that this condition is not executed when the dataBound event is triggered for other Grid actions
flag = false;
}
}
|