How to Perform Cell Validation in #ag-grid for Angular 4

Hi folks,

I have started using ag-grid in my Angular 4 project and was unable to find any API's for performing in-line cell validations i.e. whenever the user edits a particular cell, the requirement is to perform a required field and pattern validation. In case of any validation errors, the corresponding editable field should get highlighted and an error message needs to be displayed.

I have used the following cell events to fulfill the above purpose, but none of them provided me the desired result.

  • cellEditingStarted

  • cellEditingStopped


Thank you

1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team January 10, 2018 12:44 PM UTC

Hi Leviya, 

Thanks for using Syncfusion products. 

We are not providing a support for ag-grid and we are from Syncfusion Support providing ej-grid for AngularJS, Angular2 platform. Please refer to the following Help documentation for more information, 
As from your query we suspect that you want to define the column validation for while editing. If so, we have built-in support of column validation in Grid. Please refer to the following Help documentation and code example, 

Code example
<ej-grid id="Grid" [dataSource]="gridData" allowPaging="true" [toolbarSettings]="toolbarItems" [editSettings]="editSettings" >  
<e-columns>  
<e-column field="OrderID" [isPrimaryKey]="true" headerText="OrderID" [validationRules]= "{required: true, number: true }"></e-column> 
<e-column field="CustomerID" headerText="CustomerID" [validationRules]= "{ required: true, minlength: 3 }"></e-column>  
<e-column field="ShipCity" headerText="ShipCity"></e-column>  
<e-column field="Freight" headerText="Freight" editType="numericedit" [validationRules]= "{ range: [0, 1000] }" ></e-column> 
<e-column field="ShipCountry" headerText="ShipCountry" ></e-column> </e-columns> </ej-grid> 
 


If we misunderstood your requirement then could you please provide more details about your requirement? 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon