GWT 网格单元不换行

GWT grid cells don't wrap

我正在使用 GWT GridPanel。我想要其中一列换行,但我尝试过的任何方法都不起作用。在关联的 css 文件中,我试过:

.x-grid3-cell-inner .x-grid3-col-note {
    overflow: visible; white-space: normal !important;
}

其中 note 是我要换行的列的名称。没用。 我试过:

.x-grid3-cell {
    white-space:wrap;
}

没用。我试过:

.x-grid3-cell-inner {
    cell-wrap: true;
}

没用。有人有简单有效的解决方案吗?

编辑:我也试过像这样在 ColumnConfig 中设置 id:

ColumnConfig[] columns = new ColumnConfig[] {
        new ColumnConfig("Note", "note", 130, true, null, "note"),
        new ColumnConfig("Date", "date", 65, true)
};

ColumnConfig c = columns[0];
c.setId("noteColumn");

然后在css我补充说:

#noteColumn {
    overflow: visible; white-space: normal !important;
}

但这也没有用。

这是一个GWT-Ext widget。在文档中有一些关于如何包装单元格内容的示例。

For example, use this to wrap all cell contents globally

 .x-grid3-cell-inner {
      overflow: visible; white-space: normal !important;
 }

您可以在ColumnConfig中使用setId()方法:

Assigning id to ColumnConfig results in the column dom element having that ID. This is useful to apply custom css to the entire column.

如果 id = note 那么 css 规则应该是:

.x-grid3-col-note {
      overflow: auto; white-space: normal !important;
 }