简体   繁体   English

如何使搜索图标在 ag-grid 的列中永久可见?

[英]How to make the search icon permanently visible in the column in ag-grid?

I want to make the filter icon visible permanently in the Ag-grid.我想让过滤器图标在 Ag 网格中永久可见。 The current behaviour is such that the filter icons in the columns only become visible when I hover across the column headings .当前的行为是,列中的过滤器图标仅在我将鼠标悬停在列标题上时才可见。

This is an example of the column definition that I am using.这是我正在使用的列定义示例。

this.ColumnDefs=[{"headerName":"Interface","field":"interfaceName",sortingOrder: ['asc','desc', 'null'],width:120,cellStyle:{'text-align': "left"},unSortIcon: true},
{"headerName":"Status","field":"status",sortingOrder: ['asc','desc', 'null'],width:120,cellStyle:{'text-align': "left"},unSortIcon: true},
{"headerName":"Runtime","field":"lastDate",sortingOrder: ['asc','desc', 'null'],width:150,cellStyle:{'text-align': "left"},unSortIcon: true}]

How can I achieve this result?我怎样才能达到这个结果?

The correct answer is here to set suppressMenuHide in gridOptions or directly on HTML [suppressMenuHide]="true"正确的答案是在gridOptions或直接在 HTML [suppressMenuHide]="true"设置suppressMenuHide gridOptions

suppressMenuHide Set to true to always show the column menu button, rather than only showing when the mouse is over the column header. suppressMenuHide设置为 true 以始终显示列菜单按钮,而不是仅在鼠标悬停在列标题上时显示。

You can achieve it with just a small CSS.你可以用一个小的 CSS 来实现它。 No need to consider ColDef .无需考虑ColDef

Have a look at the plunk I've created: Built-In Filters Icon - show by default看看我创建的 plunk:内置过滤器图标 - 默认显示

.ag-header-icon.ag-header-cell-menu-button {
  opacity: 1 !important;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM