Hi, Does anyone encounters to save a form with more than one grid inside the form. I am trying to save a form
Function for NetProceedGrid:
Function for Amortization Grid: Please ignore the date :) I am still working on it.
Controller:
Appreciate any help. Thank you in advance!
Hi Praveenkumar,
Thank you for your feedback. I appreciate it.
I am creating a Loan where there is a need to fill out the form elements but at the same time generate an Amortization in a Grid format and Net Proceed.
The Amortization grid is automatically generated based on the input value in the "Loanable Amount" field and "Term and Charges". The Net Proceed grid is also auto-generated but the user requires to input some value in the Debit or Credit rows.
Please see my attached video and thank you very much in advance!
Hi Praveenkumar,
Thanks for helping.
1. Please let us know, When you save the batch changes in the sub Grid inside the form, Are you expecting to save that sub Grid batch changes when click the save button in the Main Grid edit dialog form?
=>Yes. You are correct. I am trying to save the Sub Grids by batch upon clicking on the Save button in the Main Grid dialog form.
2. Let us know, what type of data are you using for sub Grid’s which is inside the form - remote data or local data?
=>In SubGrid1, I think I am using Local Data. I am calling a reference table called 'dbo.LoanNetProceedType' to load in the SubGrid1. The user will fill out the Debit or Credit
=>In the SubGrid2, It is also Local Data. I am calling a reference table called 'dbo.LoanFormType' and triggers to populate values in SubGrid2.
3. If you are using remote data, please let us know what type of adaptor are you used to bind the data in the Grid?.
On Save button the Dialog Form will save the values into dbo. TxnTable1, dbo. Txn SubGrid1, dbo.TxnSubGrid2
Thank you so much Praveenkumar!
Appreciate it very much! I am new to this technology.
|
var flag = true
function actionMaster(args) { // Master Grid’s actionBegin event
if (args.requestType === "save") {
// actionBegin event will be triggered each time when the grid save action performed, so flag variable is used so that this case is executed only while pressing dialog save button
if (flag == true) {
args.cancel = true; // we prevent the master grid save action by using args.cancel property
var egridInstance = document.getElementById("EGrid").ej2_instances[0]
var dgridInstance = document.getElementById("DGrid").ej2_instances[0]
//here we check the grids inside the dialog editing have the batch changes if (egridInstance.editModule.getBatchChanges().changedRecords.length > 0) {
// if yes, we call the endEdit method for that Grid to perform save action egridInstance.endEdit();
} else if (egridInstance.editModule.getBatchChanges().changedRecords.length > 0) {
dgridInstance.endEdit();
} else {
var gridInstance = document.getElementById("Grid").ej2_instances[0];
flag = false;
gridInstance.endEdit();
}
}
}
}
function beforeBatchSaveDetail1(args) { // Sub grid’s beforeBatchSave event-1
var dgridInstance = document.getElementById("DGrid").ej2_instances[0];
if (dgridInstance.editModule.getBatchChanges().changedRecords.length > 0) {
dgridInstance.endEdit();
} else {
setTimeout(function () {
var gridInstance = document.getElementById("Grid").ej2_instances[0]
flag = false;
gridInstance.endEdit();
}, 50);
}
}
function beforeBatchSaveDetail2(args) { // Sub grid’s beforeBatchSave event-2
setTimeout(function () {
var gridInstance = document.getElementById("Grid").ej2_instances[0]
flag = false;
gridInstance.endEdit();
}, 200);
}
function actionComplete(args) {
if (args.requestType === "save") {
flag = true;
} } |
Hi Praveenkumar,
Got the sample. I will have a look at it. Thank you very much!
Hi,
There is any update on the code following API changes? I cannot make the solution work on the latest version.
Thanks and regards,
Lucian
Lucian,
We have upgraded the same sample to the latest version 23.1.44 and it was working fine at our end. Please refer the below working sample for your reference.
Sample:
Hi,
I have the same question.
Could you update the exemple?
I had have issue and I was not finding the issue.
InvalidOperationException: Cannot find reference assembly 'Microsoft.CSharp.dll' file for package Microsoft.CSharp.Reference
Roberto,
In our previous update, we have provided the working sample with the 23.1.44 version. So, if you still face the issue please try to reproduce the issue with our shared sample which was share in our previous update and share your Syncfusion package version that would be helpful for us to provide further validation of your reported problem.