enable checkbox based on column value in ag-grid

Hello, I am trying to add ag-grid table with checkbox column. Is it possible to mark checkbox as checked on bases of row value?
I have tried to find the way to do this in ag-grid documentation. where I found this https://www.ag-grid.com/javascript-data-grid/row-selection/#example-displaying-disabled-checkboxes . but not sure where I can add
onFirstDataRendered: (params) => {
    const nodesToSelect = [];
    params.api.forEachNode((node) => {
      if (node.data && node.data.year === 2012) {
        nodesToSelect.push(node);
      }
    });
    params.api.setNodesSelected({ nodes: nodesToSelect, newValue: true });
  }

Can someone help me on this?
Select a row by clicking on it. Download v30 of the best JavaScript Data Grid in the world now.
Was this page helpful?