News in versions: FastGrid 1.0, TreeGrid 17.0
FastGrid FastSheet ExamplesSamples DocumentationDoc Download Licensing Prices Buy Development
services
References References Contacts
TreeGrid Gantt chart SpreadSheet ExamplesSamples DocumentationDoc Download Licensing Prices Buy Contacts

10. Conditional formatting and styling

FastGrid can calculate cell's look according to its value or any other condition

  • Conditional Format attribute


    The

    Format

    attribute for numbers and dates can contain sections, separated by semicolon.
    Every section can start by simple condition in [ ] comparing cell value with constant, e.g. [<3] or [=1].
    The value is formatted by the first section that's contition is true.
    If there are more sections without the condition, they are implicit conditions in this order: [>0], [<0], [=0].
    The Format can also contain text color defined in [ ] (placed after the condition), e.g. [red].
    Or the Format can contain HTML code in " or ' with only CSS text attributes. The HTML format must be permitted by Cfg

    HtmlFormat

    = 1. But it can slow down paint if used in many cells!
  • Attributes calculated by ...Formula


    Every cell attribute can be calculated by

    xxxFormula

    , where the xxx is the attribute name.
    The xxxFormula can be defined only in the cell attributes in

    A

    or in default cell defined in

    DefCells

    .
    Particular default cell can be assigned to particular column(s) by setting column attribute

    DA

    . And similarly for rows. If defined DA in both row and column, the cell gets default cell of id as concated the two DA values, the row first.
    The xxxFormula cannot be defined in row, default row, column or default column.
    Often calculated cell attributes are

    Color

    ,

    TextColor

    and

    TextStyle

    .
    To calculate cell icon(s), don't assign xxxFormula to Left/Right/TextIcons, but assign it to the xxxIconFormula attribute, where xxx is the icon name defined in Left/Right/TextIcons.
  • Conditional Marks attribute


    The

    Marks

    attribute or item in

    M

    can contain JavaScript code in the Mark icon attributes.
    The icon definition must always start by icon name, the JavaScript code can be only used to calculate the mark icon parameter values!
    The most common icons used in calculated Marks are Bar to display one colored bar and Chart to display bar or line chart.
    If required, also the full Marks value can be calculated by MarksFormula.
  • Empty cells


    In empty cell there can be shown

    EmptyString

    value. It can contain HTML code, if set Cfg

    HtmlEmptyString

    = 1, but it can slow down paint if HTML used in many cells!
    Or the empty cell can contain

    EmptyValue

    value to be formatted and shown instead of empty.