Smart Mobile Studio
  • News
  • Forums
  • Download
  • Store
  • Showcases
    • Featured demos
    • The Smart Contest 2013, Round 1 – Graphics
  • Documentation
    • Get the book
    • System requirements
    • Prerequisites
    • Getting started
      • Introduction
      • Application architecture
      • The application object
      • Forms and navigation
      • Message dialogs
      • Themes and styles
    • Project types
      • Visual project
      • Game project
      • Console project
    • Layout manager
    • Networking
      • TW3HttpRequest
      • TW3JSONP
      • Loading files
  • About

Working with the grid component (part 3)

Posted on 18.02.2014 by Bojan Nikolic Posted in Developers log, Documentation

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 True.

To access Column’s footer object, use Footer property of Column. Header and Footer both share same ancestor and properties such as Caption can be found in Footer too.

Example:

W3Grid1.Columns[2].Footer.Caption := 'Totals: ';

Set formula

Beside Capion property, Footer object include a new property named FormulaKind (of 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 Caption.

Following calculations are possible on column: Sum, Average, Count, Minimum and Maximum.

To start calculating simply call CalculateFooters method of W3Grid.

Example:

// Insert and set your data first
W3Grid1.Columns[2].Footer.FormulaKind := fkSum;
W3Grid1.CalculateFooters;

If 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.

TextAfter 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.

Example:

W3Grid1.Column[2].Footer.FormulaKind := fkSum;
W3Grid1.Column[2].Footer.Caption := 'Total: ';
W3Grid1.Column[2].Footer.TextAfter := ' USD';

Sample output:

Total: 36643.43 USD

Grid tutorial
« Working with the grid component (part 2)
Smart Mobile Studio 2.0 (Hotfix 1) »

Pages

  • About
  • Feature Matrix
  • Forums
  • News
  • Release History
  • Download
  • Showcases
    • The Smart Contest 2013, Round 1 – Graphics
  • Store
  • Documentation
    • Creating your own controls
    • Debugging, exceptions and error handling
    • Differences between Delphi and Smart
    • Get the book
    • Getting started
      • Introduction
      • Local storage, session storage and global storage
      • Application architecture
      • The application object
      • Forms and navigation
      • Message dialogs
      • pmSmart Box Model
      • Themes and styles
    • Layout manager
    • Networking
      • Loading files
      • TW3HttpRequest
      • TW3JSONP
    • Prerequisites
    • Real data, talking to sqLite
    • System requirements
    • Project types
      • Visual project
      • Game project
      • Console project

Archives

  • December 2019
  • December 2018
  • November 2018
  • July 2018
  • June 2018
  • February 2018
  • September 2017
  • April 2017
  • November 2016
  • October 2016
  • September 2016
  • April 2016
  • March 2016
  • January 2016
  • October 2015
  • September 2015
  • July 2015
  • April 2015
  • January 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • November 2011
  • October 2011
  • September 2011

Categories

  • Announcements (25)
  • Developers log (119)
  • Documentation (26)
  • News (104)
  • News and articles (16)

WordPress

  • Register
  • Log in
  • WordPress

Subscribe

  • Entries (RSS)
  • Comments (RSS)
© Optimale Systemer AS