Cell style
FastGrid documentation
Grid style and look
Chosen grid style and look.
Chosen grid style for export. To not affect the export by actually chosen
Style.
Grid Style[id]
Styles
List of available styles by their id.
FastGrid has defined its default style directly in its data, in the other tags like Colors or Borders in
Styles.js.
The styles in
Styles tag modify the default style.
First is applied the
Styles.js, next the
Base style in
Styles, next all the styles in
Styles listed in the chosen style
D attribute and finally is applied the chosen style itself.
Every the
Style tag can contain all subtags like
Grid tag, but mostly it contains only the style tags used in
Styles.js like
Colors,
Borders or
Icons.
The other styles are define in separate files as
Style_{Style id}.js, where
{Style id} is the style name like "Black" or "White".
If application permits changing styles and defines some default style attributes outside the
Styles.js, these attributes should be defined in
Styles,
Base style to be reset on style change.
For example
{ Styles: { Base: { Colors: { text:"red" } } } instead of
{ Colors: { text:"red" } }.
Style string
D
The style name that is loaded with and before the chosen style. It can be also comma separated list of style names. If the style in
D has also its
D attribute, these styles are loaded too and first.
It need not contain the
Base style, it is loaded always.
Grid method bool
SetStyle
(string style)
Sets given
style to the grid
Style.
Returns true if the style has been changed, false if it was the same.
If the
style does not exist, it is still set and grid loads Base style.
API event void
OnSetStyle
(Grid grid, string style, string oldstyle, int init)
Called after the style has been changed from
oldstyle to
style.
init =
0 is when called on normal style change.
init =
1 is when called on grid loading to set actual style.
init =
2 is when called before grid export to temporary set
ExportStyle style.
init =
3 is when called after grid export to reset the style temporary set to
ExportStyle style.
Grid string[id]
Colors
All predefined color names used in FastGrid. It can contain any CSS color value like
"red",
"#F00",
"#FF0000",
"rgb(255,0,0)" or
"rgba(255,0,0,0.5).
Default definition of
Colors is in
Styles.js in root and also in the individual styles in
Styles.
Grid Font
Font
It is defined in
Styles.js and contains default font definition.
By default FastGrid uses special very fast font "LucidaSansUnicode" defined in
LucidaSansUnicode12s.woff2.js.
Grid int[id] / string[id]
Borders
All predefined border widths used in FastGrid. It is a number (in pixels, without "px" suffix).
It contains also some border-radius definitions and some item widths / heights.
Default definition of
Borders is in
Styles.js in root and also in the individual styles in
Styles.
Grid string[id]
Cursors
All predefined mouse cursors used in FastGrid. It can contain any CSS
cursor value.
Default definition of
Cursors is in
Styles.js in root.
Cell style permissions
If permitted editing cell style and format in the grid.
-1 - complete no editing style, no cell style can be changed.
0 - no editing style, sets cell with
NoEditStyle =
0 to
1.
1 - permitted editing style, does not change anything.
If permits changing cell / row / column / toolbar cell style attributes and
Format by actions.
0 | edit, mark, lock | cell formula is editable and marked editable, but is further affected by EditingStyle / Lock. Can be locked by SetNoEdit. |
1 | noedit, mark, locked 0 | cell formula is not editable and marked as not editable. Used as locked option 0 and can be unlocked by SetNoEdit. |
2 | noedit, mark | cell formula is not editable and marked as not editable. |
3 | noedit | cell formula is not editable and not marked as not editable. |
-1 | edit, mark, unlocked 0 | cell formula is always editable and marked editable and not affected by EditingStyle / Lock. Used as unlocked option 0 and can be locked by SetNoEdit. |
-2 | edit, mark | cell formula is always editable and marked editable and not affected by EditingStyle / Lock. |
-3 | edit | cell formula is always editable and not marked editable and not affected by EditingStyle / Lock. |
Cells with not editable style are not marked now.
Actions
SetNoEdit
(int target = 0, bits value = NoEdit)
Sets editing permission on the actual cell or on all focused cells.
Sets only value
-1,
0,
1, if cell
NoEdit /
NoEditStyle /
FormulaNoEdit has another value, the change is
not done.
value &
3 - changes
NoEdit;
0 - no change,
1 sets attribute to
-1,
2 clears the value or if row / col has NoEdit, sets cell attribute to
0,
3 - sets attribute to
1.
value &
12 - changes
FormulaNoEdit;
0 - no change,
4 sets attribute to
-1,
8 clears the value or if row / col has FormulaNoEdit, sets cell attribute to
0,
12 - sets attribute to
1.
value &
48 - changes
NoEditStyle;
0 - no change,
16 sets attribute to
-1,
32 clears the value or if row / col has NoEditStyle, sets cell attribute to
0,
48 - sets attribute to
1.
Cell style
Only
Align,
Indent and
Color do
not affect paint performance.
Setting to
row the attributes
VertAlign,
TextColor,
TextShadow do
not affect paint performance.
Setting to
row the attributes
TextStyle,
TextFont,
TextSize do
not affect paint performance.
VertAlign,
TextColor,
TextShadow set to many
cells or
columns have
medium performance effect.
Wrap,
TextLine set to many
cells,
rows or
columns have
medium performance effect.
TextStyle,
TextFont,
TextSize set to many
cells or
columns have
heavy performance effect.
Rotate set to many
cells,
rows or
columns have
heavy performance effect.
Setting many
different values to
TextStyle,
TextFont,
TextSize has
heavy performance effect on first paint.
How the cell text is horizontally aligned and overflown. It affects also
TextIcons. Bit array:
1., 2. bit &3 |
0 - align left - default for String type and Auto type with string,
1 - align right - default for Number and Date types and Auto type with number and date,
2 - align center (text icons placed right to text) - default for Bool type and Auto type with boolean and for NaN,
3 - align center (text icons placed left to text and the centering ignores left and right icons) |
3., 4. bit &12 | text overflow when it is wider than column width:
0 - overflow text from right,
4 - overflow text from left,
8 - overflow text from both sides - centered (implemented only without kerning) |
5. bit &16 | scrolls the cell value horizontally with part to make it visible as long as possible. It is applied only if inner cell width is wider than MinAlignScrollWidth. Defining many cells with Align&16 can remarkably slow down the scroll! |
6. bit &32 | reserved for use in AlignError. |
It can be set to
-1 instead of null to override row / column Align by cell null Align.
Minimal inner cell width in pixels to be applied
Align&
16.
Grid method int
GetAlign
(Row row, Col col)
Returns
Align for given cell. If the attribute is not set, returns
1 for types Number and Date and
0 for the others and for Auto type returns according to the value and format.
Actions
SetAlign
(int target = 0, int value = null, bool clear = 0)
OnClickAlignLeft, OnClickAlignCenter, OnClickAlignRight
Sets text horizontal alignment on the actual cell or on all focused cells. Sets the
Align to
value =
0 - left,
1 - right,
2 - center.
If
value is null, cycles the values as 0,2,1,0,... according to the value of the first iterated cell.
If set
clear and all the cells already have the
value, all the cells
Align is cleared.
How the cell content (text and all icons) is vertically aligned.
0 - align top,
1 - align bottom,
2 - align middle.
Cells are always overflown from bottom.
VertAlign is not read from column except with Important attribute.
Cells with VertAlign different than the row VertAlign slow down paint.
Default
VertAlign for the whole grid. It is used mainly for standard grid cells, all special rows and toolbars have predefined their
VertAlign in default row.
Grid method int
GetVertAlign
(Row row, Col col)
Returns
VertAlign for given cell.
If the cell
row,
col is in edit mode, returns vertical align of actually selected text or word around caret.
Actions
SetVertAlign
(int target = 0, int value = null)
OnClickAlignTop, OnClickAlignMiddle, OnClickAlignBottom
Sets text vertical alignment on the actual cell or on all focused cells. Sets the
VertAlign to
value =
0 - top,
1 - bottom,
2 - middle.
If
value is null, cycles the values as 0,2,1,0,... according to the value of the first iterated cell.
If set, places all texts with different line heights on the same baseline if set
VertAlign =
1 (bottom).
How the cell text will be wrapped to more lines. Bit array:
1., 2. bit &3 | automatic wrapping = 0 - no wrap, 1 - wrap on white space, 2 - wrap on space if possible otherwise wrap on any character, 3 - wrap on any character.
If set, restricts cell Overlay.
|
3. bit &4 | wrap always on CR / LF. If not set, ignores CR / LF - replaces all adjacent CR / LF by one space. CRLF is always replaced by LF.
To permit entering the LF by Enter key set also AcceptEnters.
|
4. bit &8 | replaces all adjacent white space (including tab and CR / LF if not set 3. bit) by one space. |
5. bit &16 | uses the wrap able cell (Wrap&3) also for column width calculation |
Cells wrapped to more lines can slow down paint.
Actions
SetWrap
(int target = 0, any value = [2])
OnClickWrapText
Sets wrapping text on the actual cell or on all focused cells. Sets the first two bits of
Wrap to
value.
value can be set to object or array to cycle / switch these value according to the first iterated cell. Not set items in the object are 0. For example [2] sets 0 => 2 and other values to 0.
Text indent from aligned edge in
IndentWidth or in actual font space widths.
It increases
PaddingLeft or
PaddingRight according to the
Align.
Width of one
Indent unit in pixels. If not set or set to 0, it is calculated as width of actual font space character in actual cell font size.
Actions
SetIndent
(int target = 0, int value = 1, int inc = 0)
OnClickIndentLeft, OnClickIndentRight
Sets or increases text indent from the left edge on the actual cell or on all focused cells. Sets the
Indent to
value.
inc =
0 - sets the
value directly to the
Indent.
inc =
1 - increases the
Indent by
value, the result cannot be less than 0.
inc =
2 - increases the first cell
Indent by
value and sets this result to all other cells'
Indent.
Cell text rotation.
0 - no rotation,
1 - text is from bottom to top (rotated 270 degrees clockwise),
2 - text is from top to bottom (rotated 90 degrees clockwise),
3 - vertical text left to right.
4 -
359 - cell rotation in degrees clockwise.
It cannot be set to Toolbar cells.
Using many cells, rows or columns with Rotate remarkably slows down paint!
Predefined rotation that is set to cell
Rotate by actions.
Actions
SetRotate
(int target = 0, int value = null, bool clear = 0)
OnClickRotate
Sets cell horizontal / vertical rotation on the actual cell or on all focused cells. Sets the
Rotate to
value =
0 - no rotate,
1 - 270 degrees,
2 - 90 degrees,
3 vertical text,
4 -
359 - degree of text rotation clockwise.
If
value is null, cycles the values as 1,2,3,0,1,... according to the value of the first iterated cell.
If
value is an array, cycles the values by this array according to the value of the first iterated cell. The array should have 4 values for every input value, e.g. [1,0,0,0] sets 1 from 0 and 0 from all other values.
If set
clear and all the cells already have the
value, all the cells
Rotate is cleared.
Cell background color.
It can be any CSS color or any color defined in
Colors object.
Predefined background color that is set to cell
Color by actions.
If set, cell background
Color overlays (mixes) the row bottom border and column right border.
If not set, cell background
Color fills just cell content area without affecting border.
If set Color to row, the vertical borders are always overlaid (mixed),
if set Color to column, the horizontal borders are always overlaid (mixed).
By default it is
1 in Header row and Header column and
0 in all other rows and columns.
What colors ignores from row colors (ColPart) and column colors (RowPart).
&
1 - Color, &
2 - Alternate, &
4 - State colors, &
8 - Focus, &
16 - Hover.
1.bit &
1 - if set, does not color the row / column changes and the active Filter.
2.bit &
2 - if set, does not color the row / column cell changes and the active Filter cell.
3.bit &
4 - if set, does not color the row / column cell readonly / editable state.
Actions
SetColor
(int target = 0, string value = null)
Sets color on the actual cell or on all focused cells. Changes the
Color to
value.
Cell background pattern, gradient or strike line, it can be:
LinearN - Linear gradient from
PatternColor to
Color,
N can be number as direction:
0 - left => right,
1 - top left => bottom right,
2 - top => bottom,
3 - top right => bottom left,
4 -
7 are the same as 0 - 3 and the gradient has two changes PatternColor -> Color -> PatternColor.
RadialN - Radial gradient from
PatternColor to
Color,
N can be number as direction:
0 - from center,
1 - from top left,
2 - from top right,
3 - from bottom right,
4 - from bottom left.
DottedN - Dotted pattern from
PatternColor,
N can be number
0 -
7 as the pattern kind.
DashedN - Dashed pattern from
PatternColor,
N can be number
0 -
8 as the pattern kind.
StrikeLN - Strike line from top left to bottom right from
PatternColor,
N can be number
0 -
12 as the line kind - width and dasharray.
StrikeRN - Strike line from top right to bottom left from
PatternColor,
N can be number
0 -
12 as the line kind - width and dasharray.
CrossN - Strike lines from top left to bottom right and from top right to bottom left from
PatternColor,
N can be number
0 -
12 as the line kind - width and dasharray.
Predefined pattern that is set to cell
Pattern by actions.
Cell pattern color.
It can be any CSS color or any color defined in
Colors object.
Predefined pattern color that is set to cell
PatternColor by actions.
Actions
SetPattern
(int target = 0, string pattern = null, string patterncolor = null, string color = null)
OnClickColor
Sets background pattern and color on the actual cell or on all focused cells.
Changes the
Pattern to
pattern,
PatternColor to
patterncolor and
PatternColor to
color.
Grid method int
GetPatternIcon
(string pattern, string patterncolor, string color)
Generates Icon displaying given
pattern. Used in Pattern icon.
Cell text color.
It can be any CSS color or any color defined in
Colors object.
Setting TextColor to many cells or to columns can slow down paint. Setting TextColor to the whole rows does not slow down paint.
Predefined text color that is set to cell
TextColor by actions.
Actions
SetTextColor
(int target = 0, string value = null)
OnClickTextColor
Sets text color on the actual cell or on all focused cells. Changes the
TextColor to
value.
CSS settings for text-decoration, bit array.
1. bit &
1 Underline,
2. bit &
2 Strike,
3. bit &
4 Overline,
4+5+6. bit &
56 Line decoration (0 - solid, 8 - double, 16 - dotted, 24 - dashed, 32 - wavy),
7+8. bit &
192 Line thickness (0 - 1px, 64 - 2px, 128 - 3px, 192 - 5px).
Setting TextLine to many cells, rows or columns can slow down paint.
Predefined text line (under/strike/over) and line decoration (solid, double, dotted, dashed, wavy) that is set to cell
TextLine by actions.
Color for
TextLine. If not set, the line has the same color as the text.
Predefined text line color that is set to cell
TextLineColor by actions.
Cfg string[]
TextLineDecorations
Predefined text line decoration CSS names to be used in 4+5+6. bit in
TextLine.
Grid method bits
GetTextLine
(Row row, Col col, bits bits = 7)
Returns
TextLine for given cell.
If the cell TextLine is not set, it returns 0.
If set
bits, checks and returns only the selected bit.
If the cell
row,
col is in edit mode, returns text line of actually selected text or word around caret.
Actions
SetUnderline
(int target = 0, bool value = null)
OnClickUnderline
Sets or clears underline on the actual cell or on all focused cells. Changes the first bit of
TextLine.
value =
1 - sets,
0 clears,
null - sets or clears the value according to the value of the first iterated cell.
Actions
SetStrike
(int target = 0, bool value = null)
OnClickStrike
Sets or clears strike on the actual cell or on all focused cells. Changes the second bit of
TextLine.
value =
1 - sets,
0 clears,
null - sets or clears the value according to the value of the first iterated cell.
Actions
SetOverline
(int target = 0, bool value = null)
Sets or clears overline on the actual cell or on all focused cells. Changes the third bit of
TextLine.
value =
1 - sets,
0 clears,
null - sets or clears the value according to the value of the first iterated cell.
Actions
SetTextLine
(int target = 0, int shadow = null, string color = null)
OnClickTextLine
Sets text line (underline / strike / overline), line decoration (solid, double, dotted, dashed, wavy) and line color on the actual cell or on all focused cells.
Changes the
TextLine to
line and
TextLineColor to
color.
CSS settings for text-shadow, bit array.
It contains only reference to
TextShadows, there are predefined 0 - 30 number shadows, the 0 is no shadow.
Setting TextShadow to many cells or to columns can slow down paint. Setting TextShadow to the whole rows does not slow down paint.
Predefined text shadow that is set to cell
TextShadow by actions.
Color for
TextShadow. If not set, the shadow has the same color as the text.
Predefined text shadow color that is set to cell
TextShadowColor by actions.
Cfg string[id]
TextShadows
Predefined text shadows to choose by
SetTextShadow action.
Actions
SetTextShadow
(int target = 0, int shadow = null, string color = null)
OnClickTextShadow
Sets text shadow and shadow color on the actual cell or on all focused cells.
Changes the
TextShadow to
shadow and
TextShadowColor to
color.
CSS settings for font-weight and font-style, bit array.
1. bit &
1 Bold, 2. bit &
2 Italic.
If set to
-1 it uses
Font TextStyle to reset value if set in row or column.
If set to
false or null, it uses
Cfg TextStyle.
It is used to calculate row height only if set HtmlHeight.
To the whole row it can be set by API only using actions SetBold / SetItalic.
Using many cells or columns with TextStyle remarkably slows down paint!
Setting TextStyle to the whole rows does not slow paint.
Default CSS settings for font-weight and font-style for this grid, bit array.
It is used in all rows and toolbars that have not set the
TextStyle. If not set,
Font.TextStyle is used.
It is changed if whole grid is focused and TextStyle is set by action
SetBold /
SetItalic.
To preset grid font, set Font.TextSize instead, it will be faster.
Font bits
TextStyle
[0]
Default CSS settings for font-weight and font-style, bit array.
It is used in all grids on page for all rows and toolbars that have not set the
TextStyle or have set it to
-1.
Grid method bits
GetTextStyle
(Row row, Col col, bits bits = 3)
Returns
TextStyle for given cell.
If the cell TextStyle is not set or is -1, it returns grid
TextStyle.
If set
bits, checks and returns only the selected bit.
If the cell
row,
col is in edit mode, returns text style of actually selected text or word around caret.
Actions
SetBold
(int target = 0, bool value = null)
OnClickBold
Sets or clears bold font on the actual cell or on all focused cells. Changes the first bit of
TextStyle.
value =
1 - sets,
0 clears,
null - sets or clears the value according to the value of the first iterated cell.
Actions
SetItalic
(int target = 0, bool value = null)
OnClickItalic
Sets or clears italic font on the actual cell or on all focused cells. Changes the second bit of
TextStyle.
value =
1 - sets,
0 clears,
null - sets or clears the value according to the value of the first iterated cell.
CSS font-family. It can be standard CSS font-family string like '"myfont",Arial,sans-serif'.
If set to
-1 it uses
Font TextFont to reset value if set in row or column.
If set to
0 or null, it uses
Cfg TextFont.
It is used to calculate row height only if set HtmlHeight.
To the whole row it can be set by API only using action SetTextFont.
Using many cells or columns with TextFont remarkably slows down paint!
Setting TextFont to the whole rows does not slow paint, but using many different fonts can slow down first paint.
Default CSS font-family for this grid. It can be standard CSS font-family string like '"myfont",Arial,sans-serif'.
It is used in all rows and toolbars that have not set the
TextFont. If not set,
Font.TextFont is used.
It is changed if whole grid is focused and TextFont is set by action
SetTextFont.
To preset grid font, set Font.TextFont instead, it will be faster.
!! Font string
TextFont
['"LucidaSansUnicode","Lucida Sans Unicode","Lucida Grande",sans-serif']
Default CSS font-family. It can be standard CSS font-family string like '"myfont",Arial,sans-serif'.
It is used in all grids on page for all rows and toolbars that have not set the
TextFont.
It is not recommended to change the default font, because it is much faster to paint than other fonts.
Cfg string[]
TextFonts
[...]
Predefined text font names (family) to choose by
SetTextFont action.
Grid method string / int
GetTextFont
(Row row, Col col)
Returns
TextFont for given cell.
If the cell TextFont is not set, it returns -1.
If the cell
row,
col is in edit mode, returns text font of actually selected text or word around caret.
Actions
SetTextFont
(int target = 0, string value = null)
Sets text font family on the actual cell or on all focused cells. Changes the
TextFont to
value.
CSS font-size.
It can be number as value in pixels. The line-height is calculated as TextSize*
LineHeightRatio.
Or it can be full CSS font-size / line-height, for example "12px/15px".
If set to
-1, it uses
Font TextSize to reset value if set in row or column.
If set to
0 or null, it uses
Cfg TextSize.
To the whole row it can be set by API only using action SetTextSize.
It is used to calculate row height only if set HtmlHeight.
Using many cells or columns with TextSize remarkably slows down paint!
Setting TextSize to the whole rows does not slow paint, but using many different sizes can slow down first paint.
Default CSS font-size for this grid.
It can be number as value in pixels. The line-height is calculated as TextSize*
LineHeightRatio.
Or it can be full CSS font-size / line-height, for example "12px/15px".
It is used in all rows and toolbars that have not set the
TextSize. If not set,
Font.TextSize is used.
It is changed if whole grid is focused and TextSize is set by action
SetTextSize.
To preset grid font, set Font.TextSize instead, it will be faster.
Font any
TextSize
["12px/14px"]
Default CSS font-size.
It is used in all grids on page for all rows and toolbars that have not set the
TextSize.
It can be number as value in pixels. The line-height is calculated as TextSize*
LineHeightRatio.
Or it can be full CSS font-size / line-height, for example "12px/15px".
Font number
TextSizeRatio
[0.75]
Conversion ratio between points and pixels (points / pixels) in for
TextSize values.
Points are used in displayed FastGrid text size and in xlsx text size. Pixels are used in TextSize and in CSS font-size in pixels.
Font number
LineHeightRatio
[1.2]
Value used to calculate line-height when
TextSize is only number.
Cfg int[]
TextSizes
Predefined text sizes to choose by
SetTextSize action.
It is array of numbers as
TextSize font size divided by
TextSizeRatio.
Grid method int
GetTextSize
(Row row, Col col)
Returns
TextSize for given cell. The value is multiplied by
TextSizeRatio.
If the cell TextSize is not set or -1, it returns the resulted TextSize, but negative.
If
row is null, returns base text size, negative.
If the cell
row,
col is in edit mode, returns text size of actually selected text or word around caret.
Grid method void
SetTextSize
(int value)
Sets the
value to grid
TextSize and marks the grid for repaint.
Actions
SetTextSize
(int target = 0, int value = 0, int inc = 0)
OnClickIncTextSize, OnClickDecTextSize
Sets or increases text size on the actual cell or on all focused cells. Sets the
TextSize to
value.
inc =
0 - sets the
value directly to the
TextSize.
value is
TextSize font size divided by
TextSizeRatio.
inc =
1 - increases the
TextSize by
value, the result cannot be less than 0.
inc =
2 - increases the first cell
TextSize by
value and sets this result to all other cells'
Indent.
Actions
ClearStyle
(int target = 0, string[] attrs = null, bool cellonly = 0, bool nohtml = 0)
Clears all style attributes from the actual cell or from all focused cells.
attrs is the list of the cell attribute names to clear.
If set to null, it is used as ["Align", "VertAlign", "Wrap", "Indent", "Rotate", "Color", "TextColor", "TextLine", "TextShadow", "TextStyle", "TextFont", "TextSize", "RowBorder", "ColBorder"].
By default it sets the attributes to their default values. If set
cellonly, sets all the attributes for cell to null to use row or column attribute values.
If
not set
nohtml, clears also all styles from html value.
Cell outer border
Shared horizontal and vertical border between cells.
Horizontal bottom border on every row. Its width is defined in
Borders by
wrowborder.
0 - none.
1 - in HTML. It is precise on zoom, not usable with
MarginTop /
MarginBottom. It is switched to
2 if there is some row spanned cell.
2 - in SVG. It can be messed on zoom, required for cell borders and for row span, defined in
Icons by
BorderBottom, the color, width or dasharray can be changed in this icon.
Vertical right border on every column. Its width is defined in
Borders by
wcolborder.
0 - none.
1 - in HTML. It is slower, precise on zoom, not usable with
MarginLeft /
MarginRight. It is switched to
2 if there is some column spanned cell.
2 - in SVG. It is faster, it can be messed on zoom, required for cell borders and for column span, defined in
Icons by
BorderRight, the color, width or dasharray can be changed in this icon.
How the row and column borders will be defined, if used row / column
Margin... attributes.
0 - if used any margin between rows or columns, the affected border will be doubled on the margin edges.
1 - if defined only
MarginBottom /
MarginRight, there will be only one border line above or left the border. If defined
MarginTop or
MarginLeft, the border will be doubled.
2 - there will be always one border line between cells regardless on the margin. The border line is always above or left to the margins.
Horizontal border above and below the cell. By default the border is for all cells the same defined by
Cfg RowBorder.
By default it is
not shown on row section edge cells (e.g. on top of the top row cells in Body), to show the border here too define
TopMarginTop,
BottomMarginBottom.
It is comma separated string or an array of border values as:
["topcolor",topwidth,"top dash array", "bottomcolor",bottomwidth,"bottom dash array"] or
["horzcolor",horzwidth,"horz dash array"].
color - any CSS or FastGrid color,
width - border width in pixels,
dash array - stroke dasharray with numbers separated by space as line1 empty1 line2 empty2,... in pixels.
Any of the values can be omited. For example:
"red" - red 1px solid border on both edges,
3 - black 3px solid border on both edges,
"4 4" - black 1px dashed border on both edges,
"red,3,4 4" - red 3px dashed border on both edges.
"red,3,blue,1" - red 3px top border and blue 1px bottom border,
",blue,2" - blue 2px bottom border,
"blue,2," - blue 2px top border,
"2,blue,3,3 4" - blue 2px top border and black 3px dashed bottom border.
Vertical left and right border of the cell. By default the border is for all cells the same defined by
Cfg ColBorder.
By default it is
not shown on column section edge cells (e.g. on left of the left column cells in Cols), to show the border here too define
LeftMarginLeft,
RightMarginRight.
It is comma separated string or an array of border values as:
["leftcolor",leftwidth,"left dash array", "rightcolor",rightwidth,"right dash array"] or
["vertcolor",vertwidth,"vert dash array"].
color - any CSS or FastGrid color,
width - border width in pixels,
dash array - stroke dasharray with numbers separated by space as line1 empty1 line2 empty2,... in pixels.
Any of the values can be omited. For example:
"red" - red 1px solid border on both edges,
3 - black 3px solid border on both edges,
"4 4" - black 1px dashed border on both edges,
"red,3,4 4" - red 3px dashed border on both edges.
"red,3,blue,1" - red 3px left border and blue 1px right border,
",blue,2" - blue 2px right border (starts by comma or empty item),
"blue,2," - blue 2px left border (ends by comma or empty item),
"2,blue,3,3 4" - blue 2px left border and black 3px dashed right border.
Border edges to set in cell
RowBorder and
ColBorder by action
SetBorder.
&
1 - top, &
2 - right, &
4 - bottom, &
8 - left,
&
16 - inner horizontal (between focused cells), &
32 - inner vertical (between focused cells).
Predefined border color that is set to cell
RowBorder and
ColBorder by action
SetBorder.
Predefined border width in pixels that is set to cell
RowBorder and
ColBorder by action
SetBorder.
Predefined border dasharray (e.g. "2 3 1 3") that is set to cell
RowBorder and
ColBorder by action
SetBorder.
If not set, spanned cell shows its right and bottom border. If set, right and bottom border is read from bottom right cell.
Which cell border will be preferred, if adjacent cells both define border on the shared side and there is no margin between.
0 - prefers top and left border,
1 - prefers bottom and right border,
2 - prefers darker border,
3 - prefers lighter border.
Actions
SetBorder
(int target = 0, int edge = 15, string color = null, int width = null, string dash = null, int clear = null, bool hidden = null)
OnClickBorder
Sets border for given edges for actual or all focused cells.
Sets the
RowBorder and
ColBorder to
color +
width +
dash.
clear =
1 also clears border in other edges than set in
edge,
2 = clears border also in edges of adjacent cells.
If set
edge =
0, it automatically sets
clear&
1 to clear all edges.
Cell inner border
Border rectangle inside cell for visual effect of various controls.
The CellBorder does not move any other cell content like icons or text. The only exception is moving cell on Toolbar cell by
CellBorderSpace.
Do not use it to recolor or restyle main cell border, it is remarkably slower to render than cell RowBorder and ColBorder!
Visual effect of inner rectangle inside the cell. It is just cell background picture, does not change text or icons position in the cell.
It can be string as id of cell border in
CellBorders,
or it can be comma separated string or an array as
"id,color,width,dasharray,background" or
["id","color",width,"dasharray","background"]
For example
CellBorder:"Select,,,,white" uses "Select" border with white background.
Any part except the
id can be omitted to use default value of the cell border
id.
id - the border from
CellBorders to display.
Some predefined cell borders accept the other parameters color,width,dasharray and fill (slower) and some borders not (faster).
color - color of the border line. It can be any CSS or FastGrid color. Default is "icon".
width - width of the border line in pixels. Default is 1.
dasharray - SVG stroke-dasharray definition as numbers separated by space, e.g. "3 6 2 4". Default is 'none'.
background - background color of the area inside border. It can be any CSS or FastGrid color. Default is 'none'.
Predefined cell borders
There are predefined cell borders in
Defaults.js in
CellBorders to be used in CellBorder
id:
Base - Base border defining default values, inherited by all other borders.
Must not be used directly.
Cell borders that accept the parameters color, width, dasharray, background:
Default - Default border used if the CellBorder has not set the
id. By default the same as "Edit".
Edit - Border around the cell text, inside cell icons.
EditWide - Border around the cell text, close to left / right, inside cell icons.
EditHigh - Border resized with row, inside cell icons.
EditHighWide - Border resized with row, close to left / right, inside cell icons.
List - Border around the cell text, outside cell icons.
ListWide - Border around the cell text, close to left / right, outside cell icons.
ListHigh - Border resized with row, outside cell icons.
ListHighWide - Border resized with row, close to left / right, outside cell icons.
ListFirst - Border around the cell text, close to right, outside cell icons. Use as the first cell in adjacent list / edits.
ListNext - Border around the cell text, without left edge, close to left / right, outside cell icons. Use as the inner cell in adjacent list / edits.
ListLast - Border around the cell text, without left edge, close to left, outside cell icons. Use as the last cell in adjacent list / edits.
Rect - Border around the whole cell height, but inside cell icons.
RectRound - Border around the whole cell height, but inside cell icons. With rounded corners.
Double - Border around the cell main border to double it.
Sealed cell borders that do not accept the parameters color, width, dasharray, background:
SimpleEdit - Light gray border around the cell text. The same as "Edit" without parameters, but slightly faster to render.
EmptyEdit - Light gray border around the cell text, filled with white background.
FillEdit - Light gray border around the cell text, filled with dark background. Should use inverse text color.
HighlightEdit - Orange border around the cell text, filled with light orange background.
SimpleList - Light gray border around the cell text, outside cell icons. The same as "List" without parameters, but slightly faster to render.
EmptyList - Light gray border around the cell text, outside cell icons, filled with white background.
FillList - Light gray border around the cell text, outside cell icons, filled with dark background. Should use inverse text color.
HighlightList - Orange border around the cell text, outside cell icons, filled with light orange background.
Button - Light blue border around the cell text, filled with the same light blue background. Used for FastGrid buttons.
ButtonHigh - The same as
Button, but resized with row.
Horizontal space in pixels in Toolbar cell between text and the
CellBorder.
It is added to
PaddingText or to
PaddingLeft /
PaddingRight if the toolbar cell has
CellBorder.
Grid CellBorder[id]
CellBorders
FastGrid root tag with all predefined cell borders.
It contains named array of all the
CellBorder objects their names can be used in cell
CellBorder id to show the border in the cell.
CellBorder string
Icon
Icon from
Icons used to render the border. The icon defines the border color, width dasharray and background and controls if these values can be customized through parameters.
CellBorder bits
Type
Flag bits to control the cell border:
&
1 -
LeftIcons and tree icons are outside the border. The icons are not moved, but cell border is shrunk.
&
2 -
RightIcons are outside the border. The icons are not moved, but cell border is shrunk.
&
4 - assigns cell
Button to the inner of the cell border only instead of the whole cell.
Ignored on toolbar.
&
8 - changes cell popup menu
List or
Suggest size to the cell border.
&
16 - updates edit size vertically, the edit box clears the cell content only inside the cell border.
&
32 - updates edit size horizontally, the edit box clears the cell content only inside the cell border.
&
64 - tree icons are outside the border. The icons are not moved, but cell border is shrunk. Ignored if set 1. bit &
1.
&
128 - mark icons are moved inside the border.
&
256 - mark state colors are applied outside border instead of inside.
&
512 -
PaddingTop and
PaddingBottom are not included in border for
TextTop and
TextBottom.
CellBorder int
Round
[0]
Round corners of the cell border in pixels.
CellBorder int
MinHeight
Minimal height of the cell border. Updates the
Top and
Bottom for too narrow cells.
CellBorder int
Top
[0]
Space between the top border and cell top edge in pixels.
0 is above cell top edge, on the above cell
RowBorder.
If
not set
TextTop, it fixes the border to the cell top and resizes border when resizing the row height.
CellBorder int
Bottom
[0]
Space between the bottom border and cell bottom edge in pixels.
0 is on cell bottom edge, directly on the cell
RowBorder.
If
not set
TextBottom, it fixes the border to the cell bottom and resizes border when resizing the row height.
CellBorder int
TextTop
If set, even to 0, it is space between the top border and text top and is used instead of
Top. Ignored for
VertAlign = 0.
If set, the top border is fixed to text top and the border does not resize when resizing the row height, but resizes if the text height changes.
CellBorder int
TextBottom
If set, even to 0, it is space between the border border and text bottom and is used instead of
Bottom. Ignored for
VertAlign = 1.
If set, the bottom border is fixed to text bottom and the border does not resize when resizing the row height, but resizes if the text height changes.
CellBorder int
Left
[0]
Space between the left border and cell left edge in pixels.
0 is before cell left edge, on the previous cell
ColBorder.
CellBorder int
Right
[0]
Space between the right border and cell right edge in pixels. 0 - on cell right edge, directly on the cell
ColBorder.
CellBorder int
ToolTop
If set, it is used instead of
Top in toolbar cell.
CellBorder int
ToolBottom
If set, it is used instead of
Bottom in toolbar cell.
CellBorder int
ToolTextTop
If set, it is used instead of
TextTop in toolbar cell.
CellBorder int
ToolTextBottom
If set, it is used instead of
TextBottom in toolbar cell.
CellBorder int
ToolLeft
If set, it is used instead of
Left in toolbar cell.
CellBorder int
ToolRight
If set, it is used instead of
Right in toolbar cell.
CellBorder bits
Edge
[15]
If set, only specified border edges will be shown - &
1 - top,
2 - right,
4 - bottom,
8 - left.
Should not be used with filled borders.
CellBorder int
EditShift
[0]
Vertical shift of the border when editing. Positive value makes the edit box narrower, negative value higher. Only if
not set
type&
16.
Alternate row and column background colors
It is possible to color every
nth row or column in different color.
Highlights odd or every
nth row or column in the part by another background color.
0 - no highlight,
2 - highlights every row / column,
2 - highlights every odd row / column,
3 - every third row / column,
4 - every fourth row / column, ...
Count of colored rows / columns in one group.
For example if set
Alternate:5, AlternateCount:2, it will color: 3 normal, 2 alternate, 3 normal, 2 alternate, ...
First row / column that will be marked with alternate color.
0 - the first row,
1 - the second row,
2 - the third row ...
For example if set
Alternate:5, AlternateCount:2, AlternateStart:1, it will color: 1 normal, 2 alternate, 3 normal, 2 alternate, 3 normal, ...
By default it is
Alternate -
AlternateCount.
1. bit &
1 - If set, resets the alternation on every
L change.
2. bit &
2 - If set, preserves alternate position also for rows / columns with
NoAlternate.
If set, excludes the row / column from the alternate colors calculation.
Grid method void
SetAlternate
(any part = DefRowPart, int alternate = null, int alternatecount = null, int alternatestart = null, int alternatetype = null, int newsheet = 0)
Sets given attributes of given part and marks grid for repaint. If the parameter is null, it is not set.
If set
newsheet, sets the attributes also for all new sheets. If set
newsheet =
2, sets them only to the new sheets.