简体   繁体   English

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

[英]nattable: how to disable single cell selection?

How to disable single cell selection when clicking? 单击时如何禁用单个单元格选择? Example

I'm trying it that way: 我正在尝试这种方式:

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());



Thanks in advance. 提前致谢。

You need to create the SelectionLayer without the default configuration 您需要在没有默认配置的情况下创建SelectionLayer

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

But with the above solution you could still select in the body because of the body mouse drag mode. 但是使用上述解决方案时,由于鼠标的拖动模式,您仍然可以在正文中进行选择。 The easy way would be to not using the SelectionLayer anyhow. 最简单的方法是不使用SelectionLayer Not sure about the other requirements you have. 不知道您有其他要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM