2335
igGrid - Custom Validation Method firing excessively
posted

Hello,

I'm working with a row edit dialog in a grid that uses custom validation methods. I'm noticing that the custom method is firing every time any field changing. Here is an example of what I am seeing. http://jsfiddle.net/a0fz6yxw/5/ Open the F12 console and then edit a row. Start typing anything in the "Color" field. Even though onchange is set to false for the Name field, it get validated every keypress even if on a different field.

This is just a basic example of what we are seeing. In our main solution, we are seeing this method getting called multiple times when the dialog opens initially (not currently duplicated in the jsfiddle). We've even had an issue where an infinite loop occurs in the validation method (unable to duplicate this on demand).

Is there any way we can limit the amount of times the custom validation is called? We only want to do it when focus is lost or the form is submitted. We are currently using this functionality to accomplish remote validation, so we want to ping the server as little as possible.

Thanks,

Paul

  • 15260
    Offline posted

    Hello Paul,

    I investigated your sample and logged a development issue about your problem in our internal tracking system. The issue is with number: 247186. At the same time I opened a private case with number: CAS-189562-M4H2L7, where you can follow the progress of the development issue.

    Please let me know if you have any further questions.

    Regards,

    Tsanna

  • 15260
    Verified Answer
    Offline posted

    Hello Paul,

    After further investigation of this behavior of excessively firing of custom validation, it seems that it's caused by the validation triggered to determine if the Done button should be enabled. As conclusion this behavior won't be fixed, but there is a workaround for it, which I'm sending you in the attached sample. Please note that the sample uses a custom provider that overrides the two methods that control the validation: validate and requestValidate. The first one is responsible for the moment of typing in the editor and the second one is responsible for the moment of submitting the typed text (when clicking the Done button). Depending on your application logic you may override both of them, or only the validate method.

    You can take a look at the sample for your reference and let me know if you have any questions.

    Regards,

    Tsanna

    sample-17.1.zip

  • 0
    Offline posted

    This page gives you a lot of information. Thank you!

    despacito lyrics