ag-grid

How can I prevent a column from being dragged out of the grid?


How can I prevent a column from being dragged out of the grid and be removed? I still want the column to be draggable and have column reordering, just don't want the removal.


Solution

  • If you don't mind the column being visible all the time, you can try this trick.

    gridOptions = {
    
            onColumnVisible: function(e,c){
                if(!e.visible){
                    e.column.gridOptionsWrapper.columnController.setColumnVisible(e.column.colId, true)
                }
            }
        };