nattable:如何禁用单个单元格选择?

nattable: how to disable single cell selection?

单击时如何禁用单个单元格选择? Example

我正在尝试这样做:

class CustomDefaultSelectionBindings extends DefaultSelectionBindings {

    @Override
    protected void configureBodyMouseClickBindings(final UiBindingRegistry uiBindingRegistry) {
       //do nothing
    }
}

class CustomDefaultSelectionLayerConfiguration extends DefaultSelectionLayerConfiguration {
    @Override
    protected void addSelectionUIBindings() {
        addConfiguration(new CustomDefaultSelectionBindings());
    }
}

final SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer);
selectionLayer.addConfiguration(new CustomDefaultSelectionLayerConfiguration());



提前致谢。

您需要在没有默认配置的情况下创建 SelectionLayer

final SelectionLayer selectionLayer = new SelectionLayer(bodyDataLayer, false);
selectionLayer.addConfiguration(new CustomDefaultSelectionLayerConfiguration());

但是由于主体鼠标拖动模式,使用上述解决方案您仍然可以 select 在主体中。简单的方法是无论如何都不使用 SelectionLayer 。不确定您的其他要求。