Complex Validation involving more than one cell value
Above validation works on cell input value. What is the solution for complex validation? For example, you have 3 columns, ColA, ColB and ColC. If I enter any value in ColA, ColB's value should be required before saving the record. Or if I update value in ColB, it should validate some custom logic on ColC and if there is error in ColC's validation, it should show the error message on ColC's value (note, we have changed value in ColB, so our cursor would be in ColB's cell).
Also, above code, adds two properties i.e. $$error and $$invalid in rowEntity if value is invalid. Instead of that, is there anyway to set the entire row valid or invalid based on all the validations on input.
@PaulL1 can you please guide here.
I solved it by below, hope it will help someone with same requirement,
Rather than trying to set the focus on error field (i.e. ColB or ColC), I just added below code in afterCellEdit().
if (!rowEntity['$$errors' + fieldName]) { rowEntity['$$errors' + fieldName] = {}; } rowEntity['$$errors' + fieldName][validatorName] = true; rowEntity['$$invalid' + fieldName] = true;
Where my fieldName is target field which I want to get validated on every cellEdit. So in my case, even if I am editing value of ColA, I will pass fieldName='ColB' and it will get validated against my validator that I will pass as 'validatorName'. If it is not proper value then it will highlight ColB as red and will show its tooltip, same for ColB edit and validating ColC.
Hope it will help someone.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had recent activity. If you believe that this is still an issue in the latest version, feel free to re-open it. Thank you for your contributions.