1
votes

In my Angular component I have checkbox selection enabled for all of my rows, but I am actually trying to only have a selection box for rows that can flower, in other words rows that node.canFlower property is true.

My checkbox selection is implemented in my component like so:

ngOnInit(): {
    ...
    this.gridOptions.rowSelection = 'single';
    this.gridOptions.suppressRowClickSelection = true;
}

I understand that checkbox selection can be enabled/disabled via a function colDef.checkboxSelection that returns true/false according to the official documentation. How do I remove checkboxes for rows that node.canFlower = false?

1
For future reference, here is complete info on disabling checkbox in ag-grid. - Shujath

1 Answers

3
votes

Not tested, but it should be close:

const columnDefs = [
    {
        headerName: 'ID',
        field: 'id',
        checkboxSelection: function(params) {
            return params.node.canFlower;
        },
    },
];