Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Reorder Column Groups inconsistent column position(Reorder entire Column Groups together, unconsistent column positioning)
icon10.gif  Reorder Column Groups inconsistent column position [message #1241210] Fri, 07 February 2014 16:30 Go to next message
Jack L is currently offline Jack LFriend
Messages: 2
Registered: February 2014
Junior Member
Im having trouble reording group of columns. Required behaviour is to move entire group of columns (all sub-columns). I have two level columns, I set behaviour to unbreakable (which makes that column cannot be drag in between grouped columns). Groups are also collapsable (don't know if that change something).
I extended ColumnGroupHeaderReorderDragMode class and override fireMoveStartCommand and fireMoveEndCommand and it works first time I move the group, but second move is like positions are shifted and works only if offset actual position by one, which could be fine if after few column moves it goes back.. so it is inconsistent....
Also seems like dragFromGridColumnPosition/dragToGridColumnPosition start indexing from 1 not from 0 ... Am I missing something? Or maybe better way of doing it?

Code:
public class ColumnGroupHeaderReorderMultiDragMode extends ColumnGroupHeaderReorderDragMode {

private ColumnGroupModel groupModel;
private ColumnReorderLayer columnReorderLayer;
private ColumnGroup currentGroup;

public ColumnGroupHeaderReorderMultiDragMode(ColumnGroupModel model, ColumnReorderLayer columnReorderLayer){
super(model);
this.groupModel = model;
this.columnReorderLayer = columnReorderLayer;
}

@Override
protected void fireMoveStartCommand(NatTable natTable, int dragFromGridColumnPosition){
int columnIndex - natTable.getColumnIndexByPosition(dragFromGridColumnPosition);
currentGroup = groupModel.getColumnIndexByPosition(dragFromGridColumnPosition);
currentGroup.setCollapsed =false;
}

protected void fireMoveEndStartCommand(NatTable natTable, int dragToGridColumnPosition){
List<Integer> currentColumnsPositions = new ArrayList<Integer>();
for(int column:currentGroup.getMembers()){
currentColumnPositions.add(columnReorderLayer.getColumnPositionByIndex(column));
}
natTable.doCommand(new ReorderColumnsAndGroupsCommand(natTable,currentColumnsPositions, dragToGridColumnPosition));
}
}
Re: Reorder Column Groups inconsistent column position [message #1241316 is a reply to message #1241210] Fri, 07 February 2014 20:00 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2495
Registered: July 2012
Senior Member
Sorry but I don't understand what the issue is. When I open the Column groups example in the NatTable examples app, dragging column groups is working the way you describe.

I also don't understand why you are extending and overriding ColumnGroupHeaderReorderDragMode.

Quote:
Also seems like dragFromGridColumnPosition/dragToGridColumnPosition start indexing from 1 not from 0


I don't know your composition, but I guess that is because the handling is started with the grid positions. And in a typical grid the row header is at index 0 when looking from the NatTable to it.
Re: Reorder Column Groups inconsistent column position [message #1245324 is a reply to message #1241316] Thu, 13 February 2014 16:43 Go to previous message
Jack L is currently offline Jack LFriend
Messages: 2
Registered: February 2014
Junior Member
Hello Dirk,
It seems like my team don't create column groups correctly, because there are not moved correctly (only one column from group is moving), and then I tried to fix that by overriding ColumnGroupHeaderReorderDragMode where I found some inconsistency with indexing, because sometimes it was off by 1 like (I had add 1 to make correct column moved) - but all of that is due to issues with our grid wrapper and the way column groups are implemented it seems like (it works on basic examples from nattable)

We will fix it at the source ... and glad it is build that way, the we should not do anything Smile

Thanks
Jack
Previous Topic:Misbehaving two-level column groups
Next Topic:SummaryRow numbers change 'randomly'
Goto Forum:
  


Current Time: Mon Sep 25 02:48:44 GMT 2017

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

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