Home  >  Q&A  >  body text

Keep full length of column headers in AgGrid

How do I tell AgGrid not to shorten my column headers? By default I'd like to be able to see the full column headers when the grid loads and not have to resize them.

P粉311617763P粉311617763426 days ago571

reply all(1)I'll reply

  • P粉469090753

    P粉4690907532023-09-14 11:00:25

    You can specify the minimum width of each column using minWidth. You can also set suppressSizeToFit to true to prevent AgGrid from calling api.sizeColumnsToFit(params).

    Example:

    // for specific column
    const columnDefs = [
      { field: 'athlete', width: 150, suppressSizeToFit: true },
      { field: 'age', width: 50, minWidth: 50 },
      { colId: 'country', field: 'country', minWidth: 300 },
      { field: 'year', width: 90 },
    ];
    
    // for all columns
    const defaultColDef = {
      suppressSizeToFit: true
    }
    

    reply
    0
  • Cancelreply