|
// Grid's commandClick event handler
function commandClick(args) {
// Command button is checked
if (args.commandColumn.title === "Dialog") {
var gridObj = document.getElementById('grid').ej2_instances[0];
// Grid's edit mode is changed to "Dialog"
gridObj.editSettings.mode = "Dialog";
// Time out is used so that the updated edit mode in the Grid can be refreshed
setTimeout(function () {
// Row index retrieved using the target command button
var rowIndex = parseInt(args.target.closest('.e-row').getAttribute("aria-rowindex"));
//Row is selected and moved to edit state
gridObj.selectRow(rowIndex);
gridObj.startEdit();
}, 100)
}
}
// Grid's actionComplete event handler
function onActionComplete(args) {
var gridObj = document.getElementById('grid').ej2_instances[0];
// Checked if record is saved or cancelled with "Dialog" edit mode
if (gridObj.editSettings.mode === "Dialog" && (args.requestType === "save" || args.requestType === "cancel")) {
// Edit mode is changed back to "Normal"
gridObj.editSettings.mode = "Normal";
}
} |
|
// Grid’s actionComplete event handler
function actionComplete(args) {
if (args.requestType === 'beginEdit' || args.requestType === 'add') {
// Height and Width of edit dialog is updated
args.form.closest('.e-dialog').style.width = "90%";
args.form.closest('.e-dialog').style.height = "90%";
}
} |