Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Programmatic Column Freezing
Programmatic Column Freezing [message #1386068] Fri, 13 June 2014 10:29 Go to next message
Rajesh Arumugam is currently offline Rajesh Arumugam
Messages: 23
Registered: October 2013
Junior Member
Hi Experts,

In my Nattable, i need to freeze one column by default programmatically. I am doing this as follows :
 nattable.doCommand(new FreezeColumnCommand(bodyLayerStack,2));

and my bodyLayerStack looks like this :
selectionLayer = new SelectionLayer(baseLayer);
viewPortLayer = new ViewPortLayer(selectionLayer);
freezeLayer = new FreezeLayer(selectionLayer);
compostiteFreezeLayer = new CompositeFreezeLayer(freezeLayer, viewportLayer,selectionLayer);
setunderLyingLayer(compostiteFreezeLayer);

This works fine when my nattable have single level column header. But the same is not working when my nattable have multi-level column grouping.
Note : both the nattable shares same bodylayerstack.

The issue is, when nattable contains multilevel column group header - its not showing my 1st row in bodylayer.

This nattable contains multi-level column header, ie 3 level. Programmatic freeze made 1st row hide.
index.php/fa/18269/0/

This nattable contains normal column header, ie single level , here its working fine.
index.php/fa/18270/0/

What is the mistake here? Please help me on this.
  • Attachment: Freeze1.PNG
    (Size: 11.02KB, Downloaded 87 times)
  • Attachment: Freeze2.PNG
    (Size: 5.98KB, Downloaded 87 times)
Re: Programmatic Column Freezing [message #1386072 is a reply to message #1386068] Fri, 13 June 2014 10:38 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1301
Registered: July 2012
Senior Member
Are you using NatTable 1.1?
Re: Programmatic Column Freezing [message #1386093 is a reply to message #1386072] Fri, 13 June 2014 11:57 Go to previous messageGo to next message
Rajesh Arumugam is currently offline Rajesh Arumugam
Messages: 23
Registered: October 2013
Junior Member
Hi Dirk,

Yes, its 1.1.

Re: Programmatic Column Freezing [message #1386098 is a reply to message #1386093] Fri, 13 June 2014 12:16 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1301
Registered: July 2012
Senior Member
Hm, maybe related to layer position transformation through the layer stack.

You can either try to fire the command directly on the body layer stack and not on the natTable instance. Or try to use the FreezeSelectionCommand by first selecting the necessary cell.

In any case, please open a ticket for further tracking.
Re: Programmatic Column Freezing [message #1386108 is a reply to message #1386098] Fri, 13 June 2014 12:41 Go to previous messageGo to next message
Rajesh Arumugam is currently offline Rajesh Arumugam
Messages: 23
Registered: October 2013
Junior Member
Hi Dirk,

I tried all cases - ie, fired the command directly on body layer stack and used
FreezeSelectionCommand after using setSelectColumn on selectionLayer.

In all the cases, it's behaving in the same manner , i.e hiding 1st row in case of multi-level column header
Re: Programmatic Column Freezing [message #1386115 is a reply to message #1386108] Fri, 13 June 2014 13:01 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1301
Registered: July 2012
Senior Member
Hm, than it might be related to your layer composition.

You can check _807_SortableFilterableColumnGroupExample. There are two column group levels, therefore 3 column header rows. It contains freezing and adding programmatic freezing in that example works as expected.
Re: Programmatic Column Freezing [message #1386378 is a reply to message #1386115] Tue, 17 June 2014 08:37 Go to previous messageGo to next message
Rajesh Arumugam is currently offline Rajesh Arumugam
Messages: 23
Registered: October 2013
Junior Member
Hi Drik,

I went through the _807_SortableFilterableColumnGroupExample. In My bodyLayerStack if i have RowHideShowLayer, then its not working. Thats what my finding. If i remove rowHideShowLayer, then the programmatic column freeze works fine as expected. But i need to use 'Hide Row' option on RowHeader and i need to use rowHideShowLayer for this. If i use, then by default 1st row becomes invisible. I have added 'Show All rows' menu on RowHeaderLayer, so after my table is loaded with default column freezing(1st row is hidden), i can able to make all rows visible by using this menu item. so i thought of calling ShowAllRowsCommand in code after calling FreezeColumnCommand() on nattable instance to make the 1st row visible. But the table comes with 1st row hidden and i need to select 'Show All rows' everytime.

-Regards,
Rajesh.
Re: Programmatic Column Freezing [message #1386381 is a reply to message #1386378] Tue, 17 June 2014 08:58 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1301
Registered: July 2012
Senior Member
I added the RowHideShowLayer to the 807 example and everything works fine.

Are you sure to call the command after natTable.configure()?

Where in your layer composition is the RowHideShowLayer located? I added it directly after the GlazedListsEventLayer. If you are not using GlazedLists you would add it directly on top of the DataLayer.
Re: Programmatic Column Freezing [message #1386385 is a reply to message #1386381] Tue, 17 June 2014 09:34 Go to previous messageGo to next message
Rajesh Arumugam is currently offline Rajesh Arumugam
Messages: 23
Registered: October 2013
Junior Member
This is my bodylayer stack.. I am using columnHideShowLayer as well.....

glazedListsEventLayer = new GlazedListsEventLayer(bodyDataLayer, eventList);
columnHideShowLayer = new ColumnHideShowLayer(glazedListsEventLayer);
rowHideShowLayer = new RowHideShowLayer(columnHideShowLayer);

// No autoconfig on selection layer
selectionLayer = new SelectionLayer(rowHideShowLayer, true);
viewportLayer = new ViewportLayer(selectionLayer);
freezeLayer = new FreezeLayer(selectionLayer);
compositeFreezeLayer = new CompositeFreezeLayer(freezeLayer, viewportLayer, selectionLayer);
setUnderlyingLayer(compositeFreezeLayer);


And yes i am calling ShowAllRowsCommand after configure(). ie, i am calling it after FreezeColumnCommand() which invokes the command, so it should work fine for ShowAllRowsCommand (), i guess.
Re: Programmatic Column Freezing [message #1386386 is a reply to message #1386385] Tue, 17 June 2014 09:46 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1301
Registered: July 2012
Senior Member
I meant the FreezeColumnCommand, is that called after configure() ... I don't need to call the other one.

Try to exchange RowHideShowLayer and ColumnHideShowLayer in the layer stack ordering.
Re: Programmatic Column Freezing [message #1386397 is a reply to message #1386386] Tue, 17 June 2014 10:29 Go to previous messageGo to next message
Rajesh Arumugam is currently offline Rajesh Arumugam
Messages: 23
Registered: October 2013
Junior Member
Yes, I am calling the FreezeColumnCommand() after configure(). And changing the order of columnHideShowLayer and RowHideShowLayer didnt help and i tried without columnHideShowLayer as well.. didn't help.
Re: Programmatic Column Freezing [message #1386401 is a reply to message #1386397] Tue, 17 June 2014 10:39 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1301
Registered: July 2012
Senior Member
Than I'm not able to help anymore. As I said before, adding the RowHideShowLayer to the _807_SortableFilterableColumnGroupExample works fine for me. I'm don't know if you have any further modifications and I am not able to reproduce the issue.

Maybe you need to check your column header layer composition. Or there are other commands you registered that are interfering.
Re: Programmatic Column Freezing [message #1386403 is a reply to message #1386401] Tue, 17 June 2014 10:48 Go to previous messageGo to next message
Rajesh Arumugam is currently offline Rajesh Arumugam
Messages: 23
Registered: October 2013
Junior Member
Thanks Drik.. Will go through my whole code once again and will see if i can find anything.. Smile
Re: Programmatic Column Freezing [message #1387139 is a reply to message #1386403] Tue, 24 June 2014 11:34 Go to previous messageGo to next message
Rajesh Arumugam is currently offline Rajesh Arumugam
Messages: 23
Registered: October 2013
Junior Member
Hi Dirk,

I went through the code and compared my code with _807_SortableFilterableColumnGroupExample. I could not find any difference. Also, I modified the _807_SortableFilterableColumnGroupExample to make use of my bodyLayerStack and with my bodyLayerStack its working fine. ie- able to freeze the column programmatically. But with my custom nattable, with same bodyLayerStack giving issue. Apart form hiding 1st row, now its hiding all data, but the configuration is not gone- ie, If i click the cell, i can able to see the value and can able to activate the editor.

index.php/fa/18356/0/

If its issue with Layer Composition, the layer composition should not work with _807_SortableFilterableColumnGroupExample, right? But this example is working fine with my bodyLatyerStack


Re: Programmatic Column Freezing [message #1387143 is a reply to message #1387139] Tue, 24 June 2014 11:47 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 1301
Registered: July 2012
Senior Member
Looks more like an issue with your grid composition. Possibly the relations from the header layers or the underlying layers are not matching correctly.
Previous Topic:Selection of row after grouping is done
Next Topic:Mouse Event Handling Problem
Goto Forum:
  


Current Time: Thu Oct 02 16:49:14 GMT 2014

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

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