简体   繁体   English

删除NatTable中的列

[英]Remove columns in NatTable

Is it possible to remove columns from NatTable (not just hide) ? 是否可以从NatTable中删除列(而不仅仅是隐藏)?

There is that DynamicColumnExample in the NatTable examples, but i just can't seem to figure out how the deletion of a column works. NatTable示例中有DynamicColumnExample ,但是我似乎无法弄清楚删除列的工作方式。 If someone could explain the steps i need to go through and how it should look like, it would be much appreciated. 如果有人可以解释我需要经历的步骤以及它的外观,将不胜感激。

Thank you! 谢谢!

It seems like every change in the list containing columns, given to the column header data provider, is reflected somehow on the UI, even if it's not an event list. 似乎给列标题数据提供者的包含列的列表中的每个更改都以某种方式反映在UI上,即使它不是事件列表也是如此。

public disposeColumns()
{
   columnList.clear();
   natTable.doCommand(new StructuralRefreshCommand());
}

Or if you have a setColumns(List columnList) method, you could just call 或者,如果您有setColumns(List columnList)方法,则可以调用

setColumns(null);

in the disposeColumns() method. 在disposeColumns()方法中。

This will work provided that the column header data provider is created based on columnList. 如果列标题数据提供程序是基于columnList创建的,则它将起作用。

Hope this will help someone else in search for this answer. 希望这会帮助其他人寻找答案。 Cheers! 干杯!

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

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