Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding styles to a specific header cell in AgGrid

I am working on AgGrid (AgGridReact component) with one of the header cells having a checkbox for 'select all'

Please refer the image here

Was wondering if there is a way to pad/margin the select-all checkbox in alignment with the checkboxes in the column.

like image 313
red_wolf Avatar asked Nov 08 '25 02:11

red_wolf


1 Answers

You can add headerClass to a specific column definition and apply the css style as usual

const columnDefs = [
  {
    checkboxSelection: true,
    headerCheckboxSelection: true,
    headerClass: "checkbox",
    width: 70
  },
  {
    headerName: "ID",
    field: "id",
    width: 70
  },
  ...
}

Css

/* add role attribute to increase specificity */
.ag-header-cell.checkbox[role="presentation"] {
  padding: 20px;
}

Live Demo

Edit 64273758/adding-padding-margin-to-a-specific-header-cell-in-ag-grid

like image 117
NearHuscarl Avatar answered Nov 11 '25 05:11

NearHuscarl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!