We have created an example of a tree grid here: Tree Grid Validation - Row Edit - StackBlitz for adding and editing rows and has validation added for required fields. What we have noticed happening is that when you edit a row, and have incorrect data, the validation will kick in and not allow you to leave the row, this is the same when you add a new row and enter incorrect data. However, if you add a new row and then immediately click off it, this new row will be added even though the required fields have not had any data entered into them. The cells will be highlighted to show there are validation errors but not until the row has been added to the grid. So how can we go about stopping users from being able to do this? Is there a new even that should be added so validation will kick in even though the user hasn't started typing anything?
Hello,
I am glad that you find my suggestion helpful.
Thank you for using Infragistics components.
Regards,
Georgi Anastasov
Entry Level Software Developer
Infragistics
What has been done here does work for the example. For what we are working on we had to take the additional step of making use of the updateValueAndValidity method, an example of this can be found here. We had thought it was due to how the validators are set up but appears something else is causing us to have to do this.
That works in the example provided, however in what we are doing, we needed an extra step of making use of the updateValueAndValidity method, I've forked your example and updated it to give an example of this. The add row event does still seem to work in the example without making use of the updateValueAndValidity method. We had thought that it was maybe due to how the validators were added that was causing us to need to use that method but obviously it is down to something else
I have been looking into your comment and yes, this is the correct approach in this situation, which I explained in my answer.
Thank you for using Infragistics components and for your cooperation.