Skip to main content



      Home
Home » Eclipse Projects » NatTable » GroupBySummary Update Parent Summary value
GroupBySummary Update Parent Summary value [message #1773618] Sat, 30 September 2017 16:02 Go to next message
Eclipse UserFriend
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 00:49 Go to previous messageGo to next message
Eclipse UserFriend
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 02:54 Go to previous message
Eclipse UserFriend
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: Wed Jul 16 02:22:50 EDT 2025

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

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

Back to the top