Currently, I am using ag-grid for my project. In one of the columns, I have a checkbox in the header using headerComponentFramework
and checkboxes in the corresponding cells using cellRendererFramework
.
My goal is to automatically check or uncheck the header checkbox based on the status of all the cell checkboxes. Additionally, I need to ensure that the data in the grid remains updated throughout this process.
If you want to see how the grid looks, you can check it out here:
You can also replicate the scenario using this link: stackblitz link.
You can access the code for the grid component here: https://stackblitz.com/edit/angular-fcgbt9?embed=1&file=src/app/grid-header-checkbox/grid-header-checkbox.component.ts
So far, I have tried a couple of approaches:
- I attempted to use a Subject to emit value changes, but it seems that the Subject is not being subscribed to inside the
agInit
hook within the header component. - I also tried using
gridApi.refreshHeader()
, but it appears that the Angular version of the header component interface (IHeaderAngularComp
) does not have a refresh hook.
Unfortunately, I am struggling to update the header checkbox value when implementing logic to check the status of all the cell checkboxes. Any attempt to update the checkbox value within the header component does not seem to work as expected.