Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » GroupBySummary Update Parent Summary value
GroupBySummary Update Parent Summary value [message #1773618] Sat, 30 September 2017 20:02 Go to next message
cenk Mising name is currently offline cenk Mising nameFriend
Messages: 159
Registered: July 2009
Senior Member
Hi,

I tested GroupBySummaryExample. when The child summary value changed not parent summary value not updated(not calculated again) How can provided updated parent summary cell when change summary child cell?

Thank you
Re: GroupBySummary Update Parent Summary value [message #1773633 is a reply to message #1773618] Mon, 02 October 2017 04:49 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
The GroupBySummaryExample is not editable. So I suppose you modified the example to make it editable and now wonder why it is not working the way you expect it. The examples are created in a way to focus on what they are introducing. Therefore you don't see code in that example that deals with that fact.

Please have a look at the Tutorial Examples - Integration - EditableGroupBySummarySummaryRowExample. There you will find the following code:

// we register a custom UpdateDataCommandHandler that ensures to
// update the tree structure
this.bodyDataLayer.unregisterCommandHandler(UpdateDataCommand.class);
this.bodyDataLayer.registerCommandHandler(new UpdateDataCommandHandler(this.bodyDataLayer) {
    @SuppressWarnings("unchecked")
    @Override
    protected boolean doCommand(UpdateDataCommand command) {
        if (super.doCommand(command)) {
            T o = ((IRowDataProvider<T>) BodyLayerStack.this.bodyDataProvider).getRowObject(command.getRowPosition());
            int rowIndex = BodyLayerStack.this.sortedList.indexOf(o);
            if (rowIndex >= 0) {
                BodyLayerStack.this.sortedList.set(rowIndex, o);
            }
            return true;
        }
        return false;
    }
});


This registers an alternative UpdateDataCommandHandler that triggers setting the changed row object to the same position in the list again. This is needed to update the tree structure in case a value was changed in the column that is used for grouping. If that column is not editable in your case, you only need to call GroupByDataLayer#clearCache()
Re: GroupBySummary Update Parent Summary value [message #1773639 is a reply to message #1773633] Mon, 02 October 2017 06:54 Go to previous message
cenk Mising name is currently offline cenk Mising nameFriend
Messages: 159
Registered: July 2009
Senior Member
Thank you. GroupByDataLayer#clearCache is solved. I call GroupByDataLayer#clearCache When row is updated.
Previous Topic:Scrolling row into view programmatically
Next Topic:Add new row header
Goto Forum:
  


Current Time: Thu Mar 28 23:16:20 GMT 2024

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

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

Back to the top