我有一个 Nattable 可以隐藏他的行号。现在,当我隐藏行号时,它不会在单元格中显示下拉列表。
我使用此代码隐藏行号:
if (showRowNumbers) {
compositeGridLayer = new GridLayer(bodyLayer, finalHeaderRow, rowHeaderLayer, cornerLayer);
} else {
compositeGridLayer = new CompositeLayer(1, 2);
compositeGridLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0);
compositeGridLayer.setChildLayer(GridRegion.BODY, bodyLayer, 0, 1);
compositeGridLayer.setChildLayer(GridRegion.COLUMN_HEADER, finalHeaderRow, 0, 0);
}
为了将下拉列表添加到单元格中,我们使用以下方法注册它:
ComboBoxCellEditor comboBoxCellEditor = new ComboBoxCellEditor(phases, -1);
comboBoxCellEditor.setMultiselect(false);
comboBoxCellEditor.setUseCheckbox(false);
comboBoxCellEditor.setFreeEdit(false);
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new ComboBoxPainter(),
DisplayMode.NORMAL, "phaseDropDown");
comboBoxCellEditor.setIconImage(GUIHelper.getImage("plus"));
configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, comboBoxCellEditor, DisplayMode.EDIT,
"phaseDropDown");
configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter() {
@Override
public Object canonicalToDisplayValue(Object canonicalValue) {
return super.canonicalToDisplayValue(canonicalValue);
}
}, DisplayMode.NORMAL, "phaseDropDown");
如何在不删除表格中的下拉菜单的情况下隐藏行号?
翻阅古今
相关分类