【发布时间】:2021-09-01 23:08:00
【问题描述】:
我需要在行悬停时在左侧显示操作按钮。以下参考有我需要的解决方案,但右侧有操作按钮。我尝试更改 css,但仍然无法正常工作。 有什么方法可以通过 CSS 实现。提前致谢
参考:ag-Grid - show buttons on row hover like in Gmail
参考 Plunker:https://plnkr.co/edit/X4hCimLy6aL3j4eh?preview
这是我用的css
.ag-pinned-left-header,
.ag-horizontal-left-spacer {
width: 0 !important;
min-width: 0 !important;
}
/* Add absolute position so that action buttons column will appear on top of other columns. pointer-events: none to pass on mousemove event to behind columns */
.ag-pinned-left-cols-container {
position: absolute !important;
left: 0;
pointer-events: none;
}
/* Reset pointer-events so that click can happen on action buttons */
.ag-pinned-left-cols-container * {
pointer-events: initial;
}
/* Hide border of left-cols-container */
.ag-pinned-left-cols-container .ag-cell {
border: none !important;
}
/* Show action buttons only for row that is being hovered. For rows which are not being hovered, hide them by setting their width and padding to 0.*/
.ag-pinned-left-cols-container .ag-row:not(.ag-row-hover),
.ag-pinned-left-cols-container .ag-row:not(.ag-row-hover) .ag-cell {
width: 0 !important;
padding: 0 !important;
}
【问题讨论】:
-
你也有你的 React 代码吗?如果您无法共享它,那么很难判断哪里出了问题,我认为按钮可能必须位于渲染方法中的其余行之上,使其首先渲染,如果它们都是同一个父母的孩子。
-
@Sodnarts ,这是我正在处理的 plunker 示例 [链接](plnkr.co/edit/Rj7AHGhOM6xQT0TW ) 如果“操作按钮”列被固定到正确的工作正常。对接如果它固定在左侧,则悬停时不会显示按钮