[CLOSED] How to force grouping summary to refresh/recalculate

  1. #1

    [CLOSED] How to force grouping summary to refresh/recalculate



    I have a grid control with several grouping summary columns:
    
    
    
    <ColumnModel ID="ColumnModel1" runat="server">
    
    
    <Columns>
    
    
    <ext:GroupingSummaryColumn 
    
    
    ColumnID="LocationName" 
    
    
    Header="Location Name" 
    
    
    Sortable="true" 
    
    
    DataIndex="LocationName"
    
    
    Width="50" 
    
    
    Hideable="false"
    
    
    SummaryType="Count">
    
    
    <SummaryRenderer Handler="return ((value === 0 || value > 1) ? '(' + value +' Bills)' : '(1 Bill)');" /> 
    
    
    </ext:GroupingSummaryColumn>
    
    
    
    
    
    <ext:GroupingSummaryColumn ColumnID="CarrierName" Header="Carrier Name" Sortable="true" DataIndex="CarrierName" Width="50" SummaryType="Count">
    
    
    <SummaryRenderer Handler="return ((value === 0 || value > 1) ? '(' + value +' Bills)' : '(1 Bill)');" /> 
    
    
    </ext:GroupingSummaryColumn>
    
    
    <ext:Column ColumnID="CarrierAccountNumber" Header="Carrier Account Number" Sortable="true" DataIndex="CarrierAccountNumber" Width="28" />
    
    
    <ext:Column ColumnID="BillDate" Header="Bill Date" Sortable="true" DataIndex="BillDate" Width="28">
    
    
    <Renderer Format="Date" FormatArgs="'m/d/Y'" />
    
    
    </ext:Column>
    
    
    <ext:GroupingSummaryColumn 
    
    
    Width="20"
    
    
    ColumnID="Amount" 
    
    
    Header="Amount" 
    
    
    Sortable="true" 
    
    
    DataIndex="Amount"
    
    
    SummaryType="Sum">
    
    
    <Renderer Format="UsMoney" />
    
    
    </ext:GroupingSummaryColumn>
    
    
    
    
    
    <ext:Column ColumnID="Details" Header="Details" Width="50" DataIndex="CarrierName" Align="Center" Fixed="true" MenuDisabled="true" Resizable="false">
    
    
    <Renderer Fn="billDetailsRender" />
    
    
    </ext:Column>
    
    
    
    
    
    <ext:Column Width="45" DataIndex="CarrierName" Sortable="false" MenuDisabled="true" Header="&amp;nbsp;" Fixed="true">
    
    
    <Renderer Handler="return '';" />
    
    
    </ext:Column>
    
    
    
    
    
    </Columns>
    
    
    </ColumnModel>
    How do I tell the grouping summary to recalculate and display new values on, say, deleting a row from the grid?
  2. #2

    RE: [CLOSED] How to force grouping summary to refresh/recalculate

    Hi,

    GroupSummary plugin recalculates automatically after any change in Grid
    *
  3. #3

    RE: [CLOSED] How to force grouping summary to refresh/recalculate



    It's not doing it consistently. My data falls into two groups so I have two rows that display totals. If I delete a row from the top group, the total for the top group is not updated. But if I delete a row from the bottom group, both totals are updated correctly.

    Here is how I'm deleting the rows:
    <BottomBar>
    <ext:ToolBar runat="server">
    <Items>
        <ext:Button ID="Approve" runat="server" Text="Approve Selected Bills" Icon="Accept" OnClick="ApproveChargesClick">
            <AjaxEvents>
                <Click OnEvent="ApproveChargesClick" Before="return approveChargesClicked();" Success="#{GridPanel1}.deleteSelected();">
                    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{GridPanel1}.body}" MinDelay="100" Msg="Approving bill...." />
                </Click> 
            </AjaxEvents> 
        </ext:Button>
    <ext:ToolbarFill runat="server" />
    <ext:Label ID="SummaryTotals" runat="server" />
    </Items>
    </ext:ToolBar>
    </BottomBar>
  4. #4

    RE: [CLOSED] How to force grouping summary to refresh/recalculate

    Hi,

    GroupSummary must recalculates a group*where there has been a change only. Could you show a full sample which we can test?
  5. #5

    RE: [CLOSED] How to force grouping summary to refresh/recalculate



    I e-mailed a file.
  6. #6

    RE: [CLOSED] How to force grouping summary to refresh/recalculate

    Hi,

    We have fixed it. Please update from SVN*
  7. #7

    RE: [CLOSED] How to force grouping summary to refresh/recalculate



    I tried the fix and I must be doing the deletion from the store incorrectly. Here is what happens:
    The first time I delete from the top group everything seems fine. After the first time, if I delete from the top group, it puts back the row(s) I just deleted minus one. If I delete from the bottom row, it restores all the deleted rows from the top part. The bottom part is fine.
    The grouping totals seem to be correct in both cases so that leaves my deletion logic although that code is pretty simple. The deletion code boils down to this:
    var records = grid.getSelections();
    for (var i = 0, len = records.length; i < len; i++) {
    grid.store.remove(records[i]); 
    }
    Is this the correct way to delete from a store?
  8. #8

    RE: [CLOSED] How to force grouping summary to refresh/recalculate

    Hi,

    The mistake is that you rebind *data on each request (you always call DataBind in Page_Load). Wrap your code inside Page_Load with*
    if(!Ext.IsAjaxRequest){...}
  9. #9

    RE: [CLOSED] How to force grouping summary to refresh/recalculate



    You're right, that was it.

    Thanks for the quick fix and quicker reply.

Similar Threads

  1. [CLOSED] Grouping Summary
    By majestic in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 18, 2011, 6:42 AM
  2. [CLOSED] Show summary in the grouping
    By Raynald_Fontaine in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 30, 2010, 5:04 PM
  3. [CLOSED] Grouping summary
    By majestic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 23, 2009, 1:33 PM
  4. [CLOSED] Remote grouping or grouping summary for GridPanel
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 08, 2009, 10:23 PM
  5. Summary Row Without Grouping
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Apr 27, 2009, 2:59 PM

Posting Permissions