【问题标题】:Set group by column without user action in table header在表头中按列设置组,无需用户操作
【发布时间】:2020-01-21 07:11:03
【问题描述】:

是否有一个选项可以自动按特定列对表数据进行分组,而无需用户操作来按表标题中的列进行分组。

当我单击列并设置组时,表按该列分组,看起来很棒,现在我需要在代码中设置该选项,无需用户交互。

谢谢

【问题讨论】:

    标签: eclipse-scout


    【解决方案1】:

    是的,您可以在列的 AbstractColumn.getConfiguredGrouped() 中返回 true。您还需要设置 getConfiguredSortIndex()。

    如果您在表格中进行了手动更改(例如更改了列宽、顺序等),您可能需要通过设置图标将表格重置为默认值。

    【讨论】:

    • 是的,我试过了,但是没有用。 check my column config
    • 嗨,都试过了。但没有运气。那是表格中的表格,而不是 tablePage 上的表格。
    【解决方案2】:

    如果您想在运行时以编程方式更改排序列,您可以使用表的列集。像这样的:

    ITable table = getTable();
    ColumnSet colSet = table.getColumnSet();
    IColumn<?> sortCol = colSet.getColumnByClass(MyColumn.class);
    colSet.addSortColumn(sortCol, true);
    

    【讨论】:

      猜你喜欢
      • 2016-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-11
      • 2018-12-02
      • 2020-02-05
      • 2017-10-13
      • 1970-01-01
      相关资源
      最近更新 更多