I am using ag-grid enterprise version and I want to disable context menu or a right click on the grid cells but I did not found any solution.
Here is my code
<ag-grid-angular #agGrid style="width: 100%; height: 100%;" id="myGrid"
[rowData]="rowData" class="ag-theme-balham" [columnDefs]="columnDefs"
[enableRangeSelection]="true" (gridReady)="onGridReady($event)"></ag-grid-
angular>

suppressContextMenu:true for gridOptions
Will work
[suppressContextMenu]="true" would do your ask.
Alternatively, if you are defining getContextMenuItems in your component, simply return empty array from the function.
this.getContextMenuItems = function getContextMenuItems(params) {
return [];
};
<ag-grid-angular
#agGrid
.........
[getContextMenuItems]="getContextMenuItems" // provide the function here
(gridReady)="onGridReady($event)"
></ag-grid-angular>
Have a look at this plunk I've created
You can also conditionally decide if you don't want it for any specific column or not using the arguments params.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With