View Full Version : [CLOSED] summarycolumn didn't recalculate automatically when data is inserted directly into the store

Jun 04, 2012, 4:31 PM
It seems that the summarycolumn didn't recalculate automatically when data is inserted into the store. How to force the summarycolumn to recalculate manually?

Here is the code to reproduce the problem:

<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">

public void add()
strColInst.Insert(0, new { instName = "abc", amount = 101.10, instPerc = 10, instCode = "a1" });


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:GridPanel ID="Panel4" runat="server" Title="Instruments" Border="false" Layout="FitLayout" Icon="PackageAdd" Selectable="true">

<ext:GridView ID="GridView1" runat="server" LoadMask="true" LoadingText="Loading..." />
<ext:Store ID="strColInst" runat="server" >

<ext:Model ID="Model1" runat="server" IDProperty="instCode">

<ext:ModelField Name="instCode" />
<ext:ModelField Name="instName" />
<ext:ModelField Name="amount" Type="Float"/>
<ext:ModelField Name="instPerc" Type="Float" />


<ColumnModel ID="ColumnModel2" runat="server">

<ext:Column ID="Column1" runat="server" Text="Instrument Name" DataIndex="instName" Flex="1">

<ext:SummaryColumn ID="SummaryColumn1" runat="server" Text="Amount" Width="90" DataIndex="amount" SummaryType="Sum">
<SummaryRenderer Handler="return Ext.util.Format.number(value, '0,000.00');" ></SummaryRenderer>

<ext:SummaryColumn ID="Column5" runat="server" Text="%" DataIndex="instPerc" Width="30" SummaryType="Sum">
<SummaryRenderer Handler="return Ext.util.Format.number(value, '00');" ></SummaryRenderer>
<ext:Summary ID="sumInst" runat="server" />

<ext:RowSelectionModel ID="ExtInvSelectionModel" runat="server" Mode="Single" />
<ext:Button Icon="Add" ID="btnAddInst" Text="Add New" runat="server" >
<Click Handler="App.direct.add()"></Click>

<ext:Button Icon="Delete" ID="btnDelInst" Text="Delete" runat="server" >






Jun 04, 2012, 7:23 PM

Please call

after inserting a row.

Jun 07, 2012, 8:28 AM
Thanks it works.

I think my problem is I don't know which object to refresh.....Thanks again