Working with footer
Beside Column’s headers, you may show footer cell for each column. In footer you may place simple text, or you may show result of formula.
Footers are not visible by default. To show footers set
ShowFooter property of W3Grid to
To access Column’s footer object, use
Footer property of Column.
Footer both share same ancestor and properties such as
Caption can be found in Footer too.
W3Grid1.Columns.Footer.Caption := 'Totals: ';
Beside Capion property, Footer object include a new property named
W3FormulaKind type). By setting this property you chose which kind of calculations (formula) will be done on this column. Result of formula will be displayed in footer, along with
Following calculations are possible on column: Sum, Average, Count, Minimum and Maximum.
To start calculating simply call
CalculateFooters method of W3Grid.
// Insert and set your data first W3Grid1.Columns.Footer.FormulaKind := fkSum; W3Grid1.CalculateFooters;
FormulaKind is anything but
fkNone, column will be calculated and result will be displayed beside footer caption. Result will be also placed inside
FormulaResult (of Double type) property.
There is one more property which may be very helpful –
TextAfter property which specifies text to be displayed beside result of formula. Usually this property contain currency sign, or some kind of measure unit.
W3Grid1.Column.Footer.FormulaKind := fkSum; W3Grid1.Column.Footer.Caption := 'Total: '; W3Grid1.Column.Footer.TextAfter := ' USD';
Total: 36643.43 USD