简体   繁体   English

加载数据后即可进行Nattable松散选择

[英]Nattable loose selection just after loading data

I'm using Nattable for almost all my tables in my application. 我在应用程序中几乎所有表都使用Nattable。 Now an user reported an issue regarding the selection in Nattable. 现在,用户报告了有关Nattable中选择的问题。

When my application loads data the data is shown, when the user select an item just after the data loading, it will remove the selection. 当我的应用程序加载数据时,将显示数据,当用户在数据加载之后选择一个项目时,它将删除选择。 When the user wait a few seconds and does the selection again it holds. 当用户等待几秒钟并再次进行选择时,它保持不变。

Is this a known behavior of Nattable? 这是Nattable的已知行为吗? For me it looks like the data is still loading when the first selection took place. 对我来说,第一次选择时,数据仍在加载中。 The data load is 11K items with multiple cell labelers. 数据加载是具有多个单元格标记的11K项。

Without seeing the details it is hard to tell. 没有看到细节,很难分辨。 Actually I wonder how something is rendered while the data is still loaded. 实际上,我想知道在仍然加载数据时如何呈现某些内容。 But I suppose you have some interesting lazy loading mechanism to make the table accessible fast. 但是我想您有一些有趣的延迟加载机制可以使表快速访问。

From my experience the behavior you describe happens because of a StructuralChangeEvent . 根据我的经验,您描述的行为是由于StructuralChangeEvent发生的。 Once the data is completely loaded such an event is fired to update all layers accordingly. 一旦数据完全加载,便会触发此类事件以相应地更新所有层。 A structural change is used to completely clear, that also implies the selection when using the default SelectionModel . 结构更改用于完全清除,这也意味着在使用默认的SelectionModel时进行SelectionModel The selection in that model is stored by row index. 该模型中的选择按行索引存储。 But as a structural change means this could have been changed, the selection is removed to avoid that something is shown selected that was not selected before. 但是由于结构上的更改意味着可能已经进行了更改,因此删除了选择内容,以避免显示某些之前未选择的内容。

Either you use an extended selection model like the RowSelectionModel or the PreserveSelectionModel or you double check when the StructuralChangeEvent is fired and if you can deal with that. 您可以使用诸如RowSelectionModelPreserveSelectionModel类的扩展选择模型,也可以RowSelectionModel检查何时触发StructuralChangeEvent以及是否可以对其进行处理。 But I suppose an alternative selection model should be more interesting with regards to your data loading mechanism. 但是我认为关于数据加载机制,替代选择模型应该更有趣。

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

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