how to identify whether validation message is rendered in grid or not

hi,

i have some columns in grid with validation rules defined.
and my requirement is to disable some button (saveData button) if the grid has validation error message.

how to find whether the grid has validation message currently or not?

please help.

5 Replies 1 reply marked as answer

SK Sujith Kumar Rajkumar Syncfusion Team April 26, 2021 09:54 AM UTC

Hi Venkatesh, 
 
Greetings from Syncfusion support. 
 
Before proceeding with the query, please share us the following information regarding your requirement, 
 
  • Do you need to disable the default ‘save’ button in the Grid’s edit dialog or some other custom button. If you are not using dialog editing, then please let us know  where you have rendered the button that you need to disable.
  • Let us know when you need to check if the validation message is displayed in the Grid? Do you need to perform this on some button click or each time the validation is checked in the Grid edit?
  • If possible share us a pictorial or video demonstration of the requirement for better understanding.
 
The above details will be helpful to clearly understand your requirement so that we can provide the proper solution. So please share us the same. 
 
Regards, 
Sujith R  



VB Venkatesh Babu S N April 27, 2021 03:54 AM UTC

hi sujith,

i am not using dailog editing. i need to disable some custom button outside the grid.

and on click of some custom button i need to know whether the validation message is displayed in grid or not.

i am using batch edit mode.





SK Sujith Kumar Rajkumar Syncfusion Team April 27, 2021 07:47 AM UTC

Hi Venkatesh, 
 
Thanks for sharing the details. 
 
You can achieve your requirement of checking if validation message is displayed in the Grid or not by using the validate method of the form object which can be retrieved from the Grid’s form module. This is demonstrated in the below code snippet, 
 
// Button click function 
onClick() { 
    // Check if Grid is in edit state(using ‘isEdit’ property) and if validation message is displayed(by checking if the edit form’s validate method returns ‘false’) in the Grid) 
    if (this.gridInst.isEdit && !this.gridInst.editModule.formObj.validate()) { 
        // Executes if the validation message is displayed for the columns 
        alert('Validation message is displayed'); 
    } 
} 
 
We have prepared a sample based on this for your reference. You can find it below, 
 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 


Marked as answer

VB Venkatesh Babu S N April 29, 2021 12:32 PM UTC

hi sujith,

thanks for the solution. this is what i was searching for. works great


SK Sujith Kumar Rajkumar Syncfusion Team April 30, 2021 06:35 AM UTC

Hi Venkatesh, 
 
You’re welcome. We are glad to hear that the provided solution worked for you. 
 
Regards, 
Sujith R 


Loader.
Up arrow icon