Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Freeze columns programmatically
Freeze columns programmatically [message #968252] Fri, 02 November 2012 10:11 Go to next message
Federico Mising name is currently offline Federico Mising nameFriend
Messages: 3
Registered: November 2012
Junior Member
Hi,
How to freeze column in Nattable programmatically?
I have a table with a large number of columns and I want to freeze the contents of first 4 columns when I build the table, so that users can scroll horizontal having the main info stored in the first columns always available.

Thanks in advance for any help
Re: Freeze columns programmatically [message #972042 is a reply to message #968252] Mon, 05 November 2012 10:00 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi,

in my first project where NatTable is used, I used the following code to freeze columns programmatically:

//get the reference to the SelectionLayer
SelectionLayer selectionLayer = this.gridLayer.getSelectionLayer();
//select cell with column position 2 and row position 0
selectionLayer.setSelectedCell(2, 0);
//freeze the first two columns
natTable.doCommand(new FreezeSelectionCommand());
//remove selection
selectionLayer.clear();


It should also be possible to do it more directly like this:
natTable.doCommand(new FreezeColumnCommand(natTable, 3));


Greez,
Dirk
Re: Freeze columns programmatically [message #1852970 is a reply to message #972042] Mon, 13 June 2022 14:23 Go to previous message
Mokhtar Alshubei is currently offline Mokhtar AlshubeiFriend
Messages: 121
Registered: November 2011
Location: Germany
Senior Member
in my case it worked as Dirk said but in an after render way via a paintListener. See https://www.eclipse.org/forums/index.php/m/1852917/?srch=freezecolumn#msg_1852917
Previous Topic:FreezeColumn Nattable 2.0.2 not working
Next Topic:Combo boxes for items with identical string representation
Goto Forum:
  


Current Time: Thu Apr 25 23:42:37 GMT 2024

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

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

Back to the top