You can also make
the grid calculate totals for you. To do this we use another feature of the GridPanel—Summary
. At its simplest, it involves the following two steps:
Declare the feature.
Set up the columns to be summarizable columns, if needed.
To declare the feature, we can extend our earlier example with the following code:
<Features> <ext:GridFilters Local="true"> <!-- Filter options go here --> </ext:GridFilters> <ext:Grouping /> <ext:Summary /> </Features>
Next, we need to configure each column to support summarizing. Until now, we have used the Column
class or <ext:Column />
to define each column. Now we will use a subclass, SummaryColumn
or <ext:SummaryColumn />
. Let's look at this, a few columns at a time:
<ext:RowNumbererColumn /> <ext:SummaryColumn Text="Company" DataIndex="Company" Flex="1" Groupable="false" SummaryType="Count"> <SummaryRenderer Handler="return '(' + value...