nanobar
nanobar

Reputation: 66355

AG-Grid: How to remove the Column Menu

I would like to remove the column menu. I can simply display: none it, but it seems a waste to process and render it in the first place. I can only find options on how to edit items inside the menu in the docs. Thanks

Upvotes: 22

Views: 30446

Answers (2)

KARTHIKEYAN.A
KARTHIKEYAN.A

Reputation: 20088

In defaultColDef property by adding suppressMenu: true column header menu will removed.

<Grid
    columnDefs={[
        {
            field: 'shortName',
            headerName: 'Short Name'
        },
        {
            field: 'entityStatus.code',
            headerName: 'Status'
        },
    ]}
    defaultColDef={{ resizable: true, sortable: true, suppressMenu: true }} // by adding suppressMenu: true munu will be disabled
    licenseKey={'abc-123'}
    onGridReady={event => event.api.sizeColumnsToFit()}
    onRowClicked={rowDataSelection}
    rowData={otherClients}
    overlayNoRowsTemplate={'No results found. Please refine your search criteria.'}
/>

Upvotes: 0

Jarod Moser
Jarod Moser

Reputation: 7338

Either setting menuTabs: [] or suppressMenu: true in the columnDefs. In this plunker the silver column demonstrates the first, while the bronze column demonstrates the second

Upvotes: 49

Related Questions