简体   繁体   English

星云Nattable-动态更改列

[英]Nebula Nattable - Change columns dynamically

I am using a Nattable inside a eclipse ViewPart . 我在Eclipse ViewPart使用ViewPart My RCP application is such that, each time I open the view, the table can have different columns based on the datamodel(represented by a different POJO) I wish to display.In short, can I do something like the below? 我的RCP应用程序是这样的,每次打开视图时,表都可以基于我希望显示的数据模型(由不同的POJO表示)而具有不同的列。简而言之,我可以执行以下操作吗? : ` :`

IWorkBenchPage page = .....;
MyView view = page.openView(MyViewID,"myview",VIEW_ACTIVATE);
IDataProvider dp = ....;
// the following statement will set the dataprovider, the necessary layers
view.dataProvider(dp);
view.getTable().refresh();
....

` `

I Believe this is possible, if you change the data provider (including the column accessor). 我相信,如果您更改数据提供者(包括列访问器),这是可能的。

I have a similar situation in my product, and I found that the easiest way is to dispose the old table and recreate a new table with the new data. 我的产品中也遇到类似的情况,我发现最简单的方法是处置旧表并使用新数据重新创建新表。

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

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