首页 文章

如何在Ag-Grid中隐藏排序顺序指示器?

提问于
浏览
1

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

我的所有专栏都是可排序的 . Ag-grid在每个 Headers 中打印一个数字,表示排序顺序 . 怎么隐藏这个?我正在使用suppressMultiSort = true,因为我只想按单列排序 .

编辑:

如果只有1列可以排序,则不会打印数字 . 但是如果可以对多于1个进行排序,agGrid会在 Headers 中显示这些数字 .

此外,一旦我点击任何 Headers 触发排序,数字就会消失 .

任何帮助将不胜感激 .

提前致谢!

1 回答

  • 2

    我可以看到你发帖中有很多问题(和你有混淆:)) .

    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执行此操作 .

    检查这个插件:ag-grid Multi Column Sort - hide sortorder numbers

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

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

    当按下Ctrl键单击列时,多列上的ag-grid排序有效 .
    如果已存在多列排序,并且如果在没有Ctrl的情况下单击任何其他列,则旧列排序将消失,并且将替换为您单击的最后一列 .

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

    [suppressMultiSort]="true"
    

    4. multiSortKey can be changed - you need to mention it as the below attribute

    multiSortKey = "ctrl";
    

    你可以在我提供的Plunk中看到 .

    希望这可以帮助 .

相关问题