Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Dynamically show and hide column
Dynamically show and hide column [message #1403239] Tue, 22 July 2014 15:10 Go to next message
Panisha RN is currently offline Panisha RNFriend
Messages: 36
Registered: May 2013
Member
Is there any good example which demonstrate how to show and hide the column from the nattable.

Columns in the table is configurable in mz case.

Please help.

Thanks & Regards
Panisha
Re: Dynamically show and hide column [message #1403241 is a reply to message #1403239] Tue, 22 July 2014 15:18 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1721
Registered: July 2012
Senior Member
Typically by adding the header menu configuration that enables the column header menu with entries for column hide/show.

Or by executing the corresponding commands on the NatTable instance.
Re: Dynamically show and hide column [message #1403383 is a reply to message #1403241] Wed, 23 July 2014 11:25 Go to previous messageGo to next message
Panisha RN is currently offline Panisha RNFriend
Messages: 36
Registered: May 2013
Member
Lets Say i have 4 out of 10 are hidden by default.

Now i have some mechanism select and deselect the column visibility using the Header manu contribution.

If have to hide the another two column what i have to do?

columnHideShowLayer.hideColumnPositions(hiddenColumnIndecies) works only for the first time.

Dznamically if i change the column configuration how to hide or show the column

the above code does not work in that case.

Question> What should be done to hide/show the column dynamically?
Re: Dynamically show and hide column [message #1403385 is a reply to message #1403383] Wed, 23 July 2014 11:31 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1721
Registered: July 2012
Senior Member
What do you mean with dynamically?

You shouldn't call columnHideShowLayer.hideColumnPositions() directly, but execute the ColumnHideCommand on the NatTable. This operates on the visible column positions and translates it correctly when it is transported down the layer stack.

https://www.eclipse.org/nattable/documentation.php?page=layer
Re: Dynamically show and hide column [message #1403400 is a reply to message #1403385] Wed, 23 July 2014 12:35 Go to previous messageGo to next message
Panisha RN is currently offline Panisha RNFriend
Messages: 36
Registered: May 2013
Member
At the moment this solve the problem,


columnHideShowLayer.showAllColumns();
columnHideShowLayer.hideColumnPositions(hiddenColumnIndecies);
natTable.update();


ColumnShowHideCommand accepts Only index that means i have to loop through and excecute it in order to hide mutiple column?

How do i find the visible column position.

In my case whenever i change preference where i configure my columns it has to be be applied to the table in preference listener and dont have any nattable event.

Re: Dynamically show and hide column [message #1403402 is a reply to message #1403400] Wed, 23 July 2014 12:49 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1721
Registered: July 2012
Senior Member
There is also a MultiColumnHideCommand.

But if you found a workaround that fits your needs, everythings ok.
Previous Topic:UI Bindings in NatTable
Next Topic:Selecting the entire row
Goto Forum:
  


Current Time: Sat Jul 04 13:47:55 GMT 2015

Powered by FUDForum. Page generated in 0.01626 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software