|
|
Re: GroupBy - how to refresh groups after data changed? [message #1744747 is a reply to message #1744737] |
Thu, 29 September 2016 21:01 |
Joachim Fox Messages: 5 Registered: January 2011 |
Junior Member |
|
|
Hi,
thank you! This doesn't feel straightforward, though (it feels expensive - actually, only a single row would have to be moved, ideally...).
In the meantime, I had come up with a different workaround solution which is probably similarily expensive:
bodyDataLayer.registerCommandHandler(new ILayerCommandHandler() {
@Override
public Class getCommandClass() {
return UpdateDataCommand.class;
}
@Override
public boolean doCommand(ILayer targetLayer, final ILayerCommand cmd) {
// some stuff to do the UpdateData goes here (actually, I'm using command and an EditingDomain here to support Undo/Redo, but that's not important...)
// test if we are really modifying data which requires a tree structure update
if (groupByModel.getGroupByColumnIndexes().contains(((UpdateDataCommand)cmd).getColumnPosition())) {
// read out the tree structure, clear it, rebuild it
List<Integer> groups = new LinkedList<Integer>();
groups.addAll(groupByModel.getGroupByColumnIndexes());
groupByModel.clearGroupByColumnIndexes();
for (Integer index: groups)
groupByModel.addGroupByColumnIndex(index);
}
return true;
}
});
Regards,
Joachim
P.S.: I'll go with your solution because admittedly, mine only works if there are no dependencies between the values of columns...
[Updated on: Thu, 29 September 2016 21:03] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03723 seconds