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 06:11 Go to next message
Federico Mising name is currently offline Federico Mising name
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 05:00 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1067
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
Previous Topic:EventList.removeAll throws IndexOutOfBoundsException
Next Topic:Sandy
Goto Forum:
  


Current Time: Wed Apr 23 02:39:28 EDT 2014

Powered by FUDForum. Page generated in 0.02065 seconds