2

I am using angular ag-grid to display some data which is coming from an API. I have some values as Boolean for them I am using checkboxes, to show the Boolean value if value is true I will show checkbox as checked and if value is false I will show checkbox as unchecked. My aim is to disable a checkbox if there is only one checkbox checked in a row. I have created a demo under this link https://stackblitz.com/edit/ag-grid-checkboxes?file=app%2Fag-grid-checkbox%2Fag-grid-checkbox.component.ts.

On load I am able to do it but If I will change the state of a checkbox I want to re-validate. Could anyone please tell me how can I achieve this?

Maik Lowrey
  • 15,957
  • 6
  • 40
  • 79
Zahid Hussain
  • 981
  • 2
  • 13
  • 28

1 Answers1

0

You can do it with reactive form. Add your checkboxes into a form group and add a validation function to check that at least one checkbox is selected.

https://stackoverflow.com/a/43386577/1353431

Arun
  • 158
  • 3
  • 17
  • for show checkboxes in ag-grid I have created a cell render component to achieve this could you please tell me how to handle my scenario in cell render component – Zahid Hussain May 17 '21 at 06:59