Here is a plunk that demonstrates my solution: https://plnkr.co/edit/X4hCimLy6aL3j4eh
It turns out that this can be achieved using just CSS. Here is how I did it:
- Add a column for showing action buttons. Use cellRenderer to render buttons in it. Pin it to right.
- Using CSS,
- absolute position the ag-pinned-right-cols-container to right
- hide right header and spacer by setting their width 0
- for rows which are not being hovered, hide action buttons cell in them by setting their padding & width 0
Here is complete CSS with explanation:
.ag-pinned-right-header,
.ag-horizontal-right-spacer {
width: 0 !important;
min-width: 0 !important;
}
.ag-pinned-right-cols-container {
position: absolute !important;
right: 0;
pointer-events: none;
}
.ag-pinned-right-cols-container * {
pointer-events: initial;
}
.ag-pinned-right-cols-container .ag-cell {
border: none !important;
}
.ag-pinned-right-cols-container .ag-row:not(.ag-row-hover),
.ag-pinned-right-cols-container .ag-row:not(.ag-row-hover) .ag-cell {
width: 0 !important;
padding: 0 !important;
}
Ag-grid's default row hover and row selected colour has some transparency. Since our action buttons column is placed absolutely over other columns, its background looks darker because of the way those transparent colours blend.

So, it is better to use background colours with no transparency in this method like this:
.ag-theme-alpine {
--ag-row-hover-color: hsl(207, 90%, 94%);
--ag-selected-row-background-color: hsl(207, 87%, 86%);
}
Overall,
Pros:-
- It's a drop-in solution. You can just drop above CSS in your code and you will get the button on hover functionality.
- This approach is framework agnostic. I have tested it on React and Angular. (For Angular, you will have to use ng-deep to workaround style encapsulation)
Cons:-
- This won't work if you already have one or more columns pinned to the right
- A future version of ag-grid might use different class names. So this CSS might need to be updated while upgrading ag-grid