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
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 message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2787
Registered: July 2012
Senior Member

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

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

Previous Topic:Mark same column values by the same color
Next Topic:Nattable builder extension
Goto Forum:

Current Time: Sun Sep 27 21:27:54 GMT 2020

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

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

Back to the top