How to implement validation rules for ag-grid row edit

删除回忆录丶 提交于 2019-12-24 19:34:55

问题


I currently have html table with inline editing that uses plain Angular Reactive Forms, including a lot of validation rules:

var formArray = new FormArray(this.items.map(createItemFormGroup));

createItemFormGroup(item){
   return new FormGroup({
        prop1: new FormControl(item.prop1, [Validators.required, Validators.min(1)])
        prop2:...
   })
}

Is there any example of how to integrate ag-grid with Angular validations? The requirement is, that I need to highlight invalid cell values. I don't necessarily need to use FormGroup…

I will probably use full row editing, so one way to go would be to create FormGroup only for row, that is being edited....


回答1:


There are two ways of possible validation handling:

First: via ValueSetter function

and

Second: via custom cellEditor component

Example one

Example two

Async validation

Extended validation



来源:https://stackoverflow.com/questions/55358430/how-to-implement-validation-rules-for-ag-grid-row-edit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!