如何在Ag-Grid中隐藏排序顺序指示器? [英] How to hide sort order indicator in Ag-Grid?

查看:273
本文介绍了如何在Ag-Grid中隐藏排序顺序指示器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AgGrid和ag-grid-angular 15.0.0

I'm using AgGrid and ag-grid-angular 15.0.0

我所有的列都是可排序的。 Ag-grid在每个标题中打印一个数字,指示排序顺序。如何隐藏这个?我使用的是preventMultiSort = true,因为我只想按单列排序。

All my columns are sortable. Ag-grid prints a number into each header, indicating the sort order. How to hide this? I'm using suppressMultiSort = true, as I wanna sort by a single column only.

编辑:

如果仅一列可排序,则不会打印数字。但是,如果可以排序的数目超过1,则agGrid会在标题中显示这些数字。

If only 1 column is sortable, the numbers are not printed. But if more than 1 can be sorted, agGrid displays those numbers in the headers..

此外,一旦我单击任何标题以触发排序,这些数字就会消失。

Furthermore, once I click any of the headers to trigger sorting, the numbers disappear..

任何帮助将不胜感激。

预先感谢!

推荐答案

我看到您的帖子中有很多问题(以及您所遇到的困惑:))。

I can see there are many questions (and confusions you are having :) ) in you post.

1。 如果只有1列是可排序的,则不会打印数字。但是,如果可以排序多于1列,则agGrid将在标题中显示这些数字。

1. "If only 1 column is sortable, the numbers are not printed. But if more than 1 can be sorted, agGrid displays those numbers in the headers.."

如果要启用多重排序并且不想看到表示排序顺序的数字,则可以使用CSS来实现。

If you want to enable multisort and don't want to see the numbers indicating sort orders, then you can do it with CSS.

检查以下小问题: ag-grid多列排序-隐藏排序序号

.ag-header-cell-label .ag-header-icon.ag-sort-order {
  display: none
}

2。 此外,一旦我单击任意标题触发排序,数字就会消失。

2. "Furthermore, once I click any of the headers to trigger sorting, the numbers disappear.."

在您单击时对多列进行排序

如果已经存在多列排序,并且单击没有 Ctrl 的任何其他列,则旧列列排序消失,它被您单击的最后一列替换。

ag-grid sorting on multiple columns works when you click on column with Ctrl pressed.
If multi-column sort is already there, and if you click on any other column without Ctrl, then the older column sorting vanished, and it is replaced with the last column you have clicked.

3。如果要禁用多重排序,则需要在 ag-grid 元素

3. If you want to disable multi-sort, you need to set below attribute on ag-grid element

[suppressMultiSort]="true"

4。 multiSortKey可以更改-您需要在以下属性中提及它

multiSortKey = "ctrl";

您可以在我提供的Plunk中看到。

You can see in the Plunk I provided.

希望这会有所帮助。

这篇关于如何在Ag-Grid中隐藏排序顺序指示器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆