Other cell features
FastGrid documentation
Cell hyperlink
If set, assigns <a> hyperlink to the cell and follows it on click.
If set
HtmlEvents, only the cell content is active as a link, otherwise the whole cell is active as a link.
Setting Link to many cells rows or columns can slow down paint.
Link target window where the
Link opens.
HTML text displayed on mouse over the link. See
Cell tooltip.
0 - the links are accessible via grid events. Click to whole cell redirects to the link.
1 - the links are accessible directly via html <a> tag. Only the link text redirects to the link.
If permitted editing cells link in the grid.
Affects only cells with
NoEditLink =
0.
-1 - no link edit, regardless on
NoEditLink.
0 - no link editing, sets cell with
NoEditLink =
0 to
1.
1 - permitted link editing, does not change anything.
2 - read only, sets cell with
NoEditLink =
0 to
4. The link prompt is displayed, but cannot be changed.
If the cell is editable. Affects standard editing cell, changing
Bool cell, changing
Check icon and showing
List,
Date and
Filter dialogs.
Not editable cells hide
List,
Date and
Filter icons and the
List (except
Popup toolbar button),
Date and
Filter dialogs cannot be shown.
Options
0,
1,
-1 can be changed by action
SetNoEdit.
0 | edit, mark, lock | cell link is editable and marked editable, but is further affected by EditingLink / Lock. Can be locked by SetNoEdit. |
1 | noedit, mark, locked 0 | cell link is not editable and marked as not editable. Used as locked option 0 and can be unlocked by SetNoEdit. |
2 | noedit, mark | cell link is not editable and marked as not editable. |
3 | noedit | cell link is not editable and not marked as not editable. |
4 | readonly, mark | cell link is read only and marked as read only. |
-1 | edit, mark, unlocked 0 | cell link is always editable and marked editable and not affected by EditingLink / Lock. Used as unlocked option 0 and can be locked by SetNoEdit. |
-2 | edit, mark | cell link is always editable and marked editable and not affected by EditingLink / Lock. |
-3 | edit | cell link is always editable and not marked editable and not affected by EditingLink / Lock. |
Link editing permissions are not marked now.
If set (by default), it is restricted to show links with "javascript:" protocol.
It can predefine CSS style for all links in grid.
It can have these attributes:
Link - default link,
Hover - hovered link,
Visited - visited link,
VisitedHover - hovered visited link,
Active - link in time of click.
It can contain standard CSS text attributes like
color,
font and
textDecoration attributes.
For example:
LinkCSS: { Link:"font-weight:bold;", Hover:"color:green;", Visited:"font-weight:normal;", VisitedHover:"color:brown;", Active:"font-style:italic;" }
Actions
ShowLink
(int target = 0)
OnClickLink
Opens the
Link in window
Target.
Actions
EnterLink
(int target = 0)
OnShiftClickAny
Prompts user for
Link value.
API event any
OnShowLink
(Grid grid, Row row, Col col, string href, string target)
Called before navigates to the cell
Link.
href is the
Link,
target is the
Target.
Return new string for
href to navigate here. Or return true to cancel the action.
Cell tooltip
HTML text displayed on mouse over the cell.
Default value for Toolbar cell Tip is "$"+DefTool+"Tip".
When the cell
Tip is displayed.
0 - never,
1 - on mouse hover,
2 - on click and disables all other click actions.
How long mouse must be on the cell (or Icon / Image / Link) to show its
Tip. In milliseconds.
Where and how the
Tip will be displayed, it has the same structure as
Dialog Place.
It can contain also style attribute like
Message style,
TextColor,
TextStyle,
TextLine,
TextLineColor,
TextFont,
TextSize,
TextShadow,
TextShadowColor,
Color,
Border (inner border),
Margin,
Padding,
Default value is
{ Animate:200, Shift:-5, VertAlign:3, Update:7, Fixed:1, Shadow:"3px 3px 0px 0px tipshadow", HeaderShadow:"0px 0px 0px 3px tipshadow", Color:"tipback", TextStyle:0, TextSize:12, TextFont:"Arial,sans-serif", TextColor:"texttip", Padding:"2px 4px", Border:"" }.
Overrides
TipPlace settings in tip for
Image.
How marks the cells with
Tip.
0 - no,
1 -
8 -
Mark icon in given corner -
1 - at top left, to right,
2 - at top left, to down,
3 - at top right, to left,
4 - at top right, to down,
5 - at bottom right, to left,
6 - at bottom right, to up,
7 - at bottom left, to right,
8 - at bottom left, to up,
9 - background color,
10 -
not used,
11 -
18 - background color and
Mark icon in given corner (like
1 -
8).
If overflowed cell that does not display its full value shows the value as tip. It is
not used for toolbars.
0 - no,
1 only if the cell has no
Tip,
2 on
Tip bottom,
3 on
Tip top.
If overflowed toolbar cell that does not display its full value shows the value as tip.
0 - no,
1 only if the cell has no
Tip,
2 on
Tip bottom,
3 on
Tip top.
By default it is set to
1 in
Drag toolbar and its ancestors and
0 in all other toolbars.
Separator placed between
Tip and cell value shown by
TipValue.
If set, the cell does not display its value as tip either if set
TipValue.
Actions, Cell, Tool bool
OnTip
(Grid Grid, Row Row, Col Col, Event Event)
GetAttr SetAttr
JSON event handler (JavaScript code in string) called to show cell tip, called in time the cell
Tip is to be displayed.
Default value is set in Defaults.js in Actions tag as
OnTip:"ShowTip()".
It is possible to show menu instead of the tip, e.g.
OnTip:"ShowMenu(0,'|$Delete|HideRows(1,null,1)|$Delete|ShowRows(0,5)|$Delete|ShowRows(0,4)|-||$Delete|HideCols(1,null,1)|$Delete|ShowCols(0,5)|$Delete|ShowCols(0,4)')"
Or call any other action, e.g. ShowCalendar.
Return true if the tip was displayed to call
OnHideTip after mouse moves the cell.
It is called only if the cell has set Tip, to show custom tip in this event, set the cell Tip to some dummy value!
API event any
OnShowTip
(Grid grid, Row row, Col col, string tip)
Called before the cell
Tip is shown.
Return
empty string to not show the tip.
Or return
string or
number to change the tip text to show.
Or show the tip in another way and return
object as custom data that will be passed to
OnHideTip to hide the custom tip.
Or return
null to continue without change.
API event bool
OnHideTip
(Grid grid, object tip)
Called before the tip is hidden. Return true to not hide the tip.
If the tip was shown by
ShowTip action,
tip is object with attributes
Row,
Col,
Place,
Tip (as not translated text),
Tag as the Html tag.
If the tip was shown by any other dialog in
OnTip, it has
not set the
Place and
Tag.
If the tip was shown as custom tip by
OnShowTip, it is the returned value by the
OnShowTip.
Grid method void
ShowTip
(Row row, Col col, string tip, object tipplace = TipPlace)
Shows
tip for given cell.
Grid method void
HideTip
(bool noanimate = 0)
Hides actually displayed tip in grid. For
noanimate = 1 hides the tip immediately without animation.
Actions
ShowTip
(int target = 0)
OnTip
Shows
Tip for actual or focused cell.
Grid method void
EditTip
(Row row, Col col, string tip = null)
Lets a user to enter new text for the
Tip for given cell. Entering empty string removes the tip.
tip is predefined value shown in the prompt. If not set, the cell
Tip is shown.
Actions
EditTip
(int target = 0)
OnAddTip
Lets a user to enter new text for the
Tip for actual or focused cell. Entering empty string removes the tip.
Grid method void
SetTipAction
(int value = null)
Sets given
value to
TipAction. If
value is null, changes
TipAction as 0 => 2, 1 => 1, 2 => 0.
Static cells
Static cells are
not recreated during Paint, their assigned JavaScript and HTML objects and events persist during the while grid lifetime.
The DOM content of static cell can be accessed directly.
Only a few static cells per grid should be used otherwise it will affect grid performance!
Static cells can be used to display and refresh some text or HTML in grid without repaint.
Static cell can be used also to include external objects or components.
Sets the cell as static cell that is not repainted and preserves its content.
Only a few static cells per grid should be used otherwise it will affect grid performance!
The static cells can also overlay to the next column part cells if set
OverlayParts.
API event bool
OnStatic
(Grid grid, Row row, Col col, HTMLElement tag, HTMLElement new)
Called when static cell is created (
new is null) or after it was repainted.
During Paint the static cell is removed from DOM and returned back to DOM before call of this event.
tag is static cell parent tag, its content (child tags / innerHTML) can be modified.
new is new tag for static cell with updated content created during Paint. It was removed from DOM and replaced by the
tag.
If returned
true, the
tag is removed from DOM and replaced by
new to use the new generated content for the cell.
Grid method HTMLElement
GetStatic
(Row row, Col col)
Returns the parent tag for given static cell. Returns null if the cell is not static or does not have generated the tag yet.
The content of the returned tag (child tags / innerHTML) can be modified.
The changes in the content must
not affect the cell position and size.
Other cell attributes
If the cell is diabled.
If set to
1, it disables all cell buttons and editing. The cell can be still focused (see
NoFocus), hovered (see
NoHover) and can display tooltip (see
Tip).
If set to
2, it also displayes the cell semi transparent.
Action button assigned to the cell. If clicked cell content where is no icon, the
Button action is run.
Set e.g. Button:"
List" to show list on click to the whole cell or "
Date" to show calendar or "
None" to do nothing instead of cell editing.
Actions
ClickButton
(int target = 0, bits flags = 0)
OnEnter, OnSpace
Simulates click to the cell with
Button set and optionally runs also other cell OnClick actions.
flags what is also called: &
1 - call
OnClickCell /
OnClickTool events before, &
2 - call
OnClick event before, &
4 - call
OnClickAny event after,
&
8 - call first icon Button if any, if no cell
Button is set.
If cell
Overlay is applied.
Maximal width of the checked overlay. If the overlaying content is wider than this value, it is it cut off.
Decrease it to to speed up painting, increase it if the overlaying content can be wider.
&
1 =
1 the cell text can overlay the next empty cell (
Align =
0) or the previous empty cell (
Align =
1) or both previous and next empty cells (
Align =
2,
3).
&
2 =
2 previous and next cell text cannot overlay this cell even if it is empty.
&
4 =
4 can extend this or previous centered cell (
Align =
2,
3) right to center it in more adjacent empty cells. Like
centerContinuous in xlsx.
&
8 =
8 if set with &
1, the cell text can overlay the next empty cell even if the source cell has column span.
If the horizontally overflowed cell value is cut off or shows ellipsis ...
1.bit &
1 = 1 - shows ellipsis for cells overflowed left (
Align =
0).
2.bit &
2 = 2 - shows ellipsis for cells overflowed right (
Align =
4).
3.bit &
4 = 4 - shows ellipsis for cells overflowed centered (
Align =
8).
It does not affect cells with HTML code, they are always cut off.
From which side overflows numbers in Number and Date types and numbers and dates in Auto type.
0 - according to align,
1 - always from right,
2 - always from left.
Row and column attributes to speed up
Setting these attributes will speed up FastGrid by disabling specified features for specified column, row or cell. Be careful when using these attributes!
It is strongly recommended to set up the Fx attributes after the grid layout is fully defined and only in case the grid is too slow!
The
Fx attributes can be set only to row or column, as integer. To row can be set also as object with attributes as column
id (preferred) or column
FID, e.g.
FV: { Col1:31, Col2:0, DefCol1:27 }.
Faster is setting them to column.
!! Row, Col bits / object
FV
[ ] / [3] GetAttr
Fast value. Speeds up reading raw cell value.
If set to
row, it can be set also as object with attributes as column
id or column
FID, e.g.
FV: { Col1:31, Col2:0, DefCol1:27 }.
If set to
0, it reads the cell value only from
V,
U,
Index and
MirrorValues.
If set to
255 or to
null or not set, it reads the cell value from all sources. It is read in this order: from row as object, from Important column, from row as integer, from column, the first non null value is used.
It is added as
~ to
direct parameter in
GetValue method.
1. bit | &1 | if set, calculates JavaScript formula in F / Formula. |
2. bit | &2 | if set, calculates editable formula in E. |
3. bit | &4 | if set, calls OnGetValue API event and if required also OnGetNumber, OnGetRange API events. |
4. bit | &8 | if set, reads attributes Value and Mirror. Note that Group row cell value in main column and also single Pivot data values use Mirror. |
5. bit | &16 | if set, reads attributes SortValue, FilterValue, SearchValue, ExportValue. |
6. bit | &32 | if set, reads attributes NoFilterRow, NoFilterCol, NoSearch. |
7. bit | &64 | if set, uses SpannedValue in hidden spanned cell. |
!! Row, Col bits / object
FT
[ ] / [30 = 2+4+8+16] GetAttr
Fast type. Speeds up converting cell value to string for display, print, edit, export, copy to clipboard, etc.
If set to
row, it can be set also as object with attributes as column
id or column
FID, e.g.
FT: { Col1:31, Col2:0, DefCol1:27 }.
1 - 5. bits | &31 |
Simple cell type. Setting it, mostly ignores cell attributes Type Format and List attributes, but these attributes should be still set, because they are used by other features.
0 | raw string | uses the string as is, the string must not contain html characters '<' and '&' to display it corretly. Takes Type = "String". |
1 | string without html | checks and removes html code. Takes Type = "String". |
2 | string with html | uses the string as is. Takes Type = "Html". |
3 | empty string | does not read the cell value and always returns "". Takes Type = "String". It does not affect reading raw cell value. |
4 | number without Format | takes Format = "" and Type = "Number". |
5 | number "fg" | takes Format = "fg" as general format and Type = "Number". |
6 | number "ff" | takes Format = "ff" as fixed format and Type = "Number". |
7 | number "fc" | takes Format = "fc" as currency format and Type = "Number". |
8 | number "fp" | takes Format = "fp" as percent format and = "Number". |
9 | number with Format | reads Format attribute and takes Type = "Number". |
10 | date "fd" | takes Format = "fd" as date format and Type = "Date". |
11 | date "ft" | takes Format = "ft" as time format and Type = "Date". |
12 | date "fh" | takes Format = "fh" as datetime format and Type = "Date". |
13 | date with Format | reads Format attribute and takes Type = "Date". |
14 | universal date with attributes | reads attributes Format, TimeZone and DefaultDate. Takes Type = "Date". |
15 | bool | takes Type = "Bool". |
16 | simple list | uses List attribute only for write existing value only, for read is the same as 1 as string. Takes Type = "String" |
17 | simple html list | uses List attribute only for write existing value only, for read is the same as 2 as html string. Takes Type = "Html" |
18 | list | reads List attribute and takes IndexList = 0 and Type = "String". |
19 | html list | reads List attribute and takes IndexList = 0 and Type = "Html". |
20 | index list | reads List attribute and takes IndexList = 2 and Type = "String". |
21 | index html list | reads List attribute and takes IndexList = 2 and Type = "Html". |
22 | related list | reads List and ListRelated attributes and takes IndexList = 0 and Type = "String". |
23 | related html list | reads List and ListRelated attributes and takes IndexList = 0 and Type = "Html". |
24 | related index list | reads List and ListRelated attributes and takes IndexList = 2 and Type = "String". |
25 | related index html list | reads List and ListRelated attributes and takes IndexList = 2 and Type = "Html". |
26 | universal list | reads attributes List, ListRelated, NoListValue and IndexList. Takes Type = "String". |
27 | universal html list | reads attributes List, ListRelated, NoListValue and IndexList. Takes Type = "Html". |
28 | reserved | |
29 | reserved | |
30 | auto | takes Type = "Auto", reads Format attribute and chooses from FT values 1, 2, 9, 13, 15. |
31 | universal | reads all required attributes according to the Type |
|
6. bit | &32 | takes Range: 0 - Range = 0, 32 - Range = 1. |
7. bit | &64 | if set, reads also Range attribute and ignores 6. bit &32. |
8. bit | &128 | if set, reads also EmptyValue / EmptyString. |
9. bit | &256 | if set, reads also Translate. If not set, Translate is 1 for Simple type resulted to String Type otherwise 0. |
10. bit | &512 | if set, reads also Text attribute. |
11. bit | &1024 | if set, calls also OnGetString API event. |
!! Row, Col bits / object
FS
GetAttr
Fast style. Speeds up displaying, printing or exporting cell styles.
If set to
row, it can be set also as object with attributes as column
id or column
FID, e.g.
FS: { Col1:31, Col2:0, DefCol1:27 }.
1,2. bit | &3 | Align | 0 - align left, 1 - align right, 2 - align center, 3 - read Align attribute. |
3,4. bit | &12 | Wrap | 0 - no wrap (takes Wrap = 0), 4 - Wrap CRLF (takes Wrap = 4), 8 - Wrap CRLF + Space (takes Wrap = 5), 12 - reads Wrap attribute. |
5. bit | &16 | VertAlign | 0 - ignored cell VertAlign, reads only row VertAlign, 16 - read cell VertAlign. |
6. bit | &32 | Border | if set, reads RowBorder and ColBorder attributes. |
7. bit | &64 | Color | if set, reads Color attribute. |
8. bit | &128 | Pattern | if set, reads Pattern attribute. |
9. bit | &256 | TextColor | if set, reads TextColor attribute. |
10. bit | &512 | TextStyle | if set, reads TextStyle attribute. |
11. bit | &1024 | TextLine | if set, reads TextLine attribute. |
12. bit | &2048 | TextShadow | if set, reads TextShadow attribute. |
13. bit | &4096 | TextSize | if set, reads TextSize attribute. |
14. bit | &8192 | TextFont | if set, reads TextFont attribute. |
15. bit | &16384 | Indent | if set, reads Indent attribute. |
16. bit | &32768 | Rotate | if set, reads Rotate attribute. |
!! Row, Col bits / object
FA
[ ] / [27 = 3+8+16] GetAttr
Fast attributes. Speeds up displaying, printing or exporting cell styles.
If set to
row, it can be set also as object with attributes as column
id or column
FID, e.g.
FA: { Col1:31, Col2:0, DefCol1:27 }.
1,2. bit | &3 | NoEdit | 0 - editable, 1 - not editable, 2 - always editable, 3 - reads NoEdit attribute. |
3. bit | &4 | Disabled | 0 - not disabled, 4 - reads Disabled attribute. |
4. bit | &8 | Link | if set, reads Link attribute. |
5. bit | &16 | Tip | if set, reads Tip attribute. |
6. bit | &32 | CellBorder | if set, reads CellBorder attribute. |
7. bit | &64 | Marks | if set, reads Marks attribute. |
8. bit | &128 | LeftIcons | if set, reads LeftIcons attribute. |
9. bit | &256 | RightIcons | if set, reads RightIcons attribute. |
10. bit | &512 | TextIcons | if set, reads TextIcons attribute. |
11. bit | &1024 | PaddingLeft, PaddingRight | if set, reads PaddingLeft and PaddingRight attributes. If not set, reads the attributes only from column. |
12. bit | &2048 | IconPaddingLeft, IconPaddingRight | if set, reads IconPaddingLeft and IconPaddingRight attributes. If not set, reads the attributes only from column. |
13. bit | &4096 | IconSpace, IconWrap, IconVertAlign | if set, reads IconSpace, IconWrap and IconVertAlign attributes. If not set, reads the attributes only from column. |
14. bit | &8192 | Static | if set, reads Static attribute. |
!! Row, Col bits / object
FE
[0] GetAttr
Fast export. Speeds up exporting to xlsx and html and copying to clipboard as html. It also controls some exporting behavior.
If set to
row, it can be set also as object with attributes as column
id or column
FID, e.g.
FE: { Col1:31, Col2:0, DefCol1:27 }.
1. bit | &1 | exports cell attributes. |
2. bit | &2 | exports cell attributes set in row and column. |
3. bit | &4 | normalizes exported html code. |
4. bit | &8 | exports Link. |
5. bit | &16 | exports Tip. |
6. bit | &32 | exports row span. |
7. bit | &64 | exports column span. |
8, 9. bit | &384 | default is 0; if ignored column span (by ~FE&64 or ExportSizes without ColSpan) exports the value aligned as center continuous if:
0 - is aligned left or center, 128 - also if aligned right, 256 - also if it is not spanned, but other cells are spanned due ExportSizes ColSpan, 384 - never.
Does not work for row spanned cells. |
10. bit | &512 | default is 0; if set, adds ExportStringPrefix before the value when exporting as csv/text or as xlsx/html without format. To copy dates or numbers as strings.
For ExportXlsx / ExportHtml / ExportCsv / CopyText / CopyHtml = 2 is used only for Date types, for 3 is used for all types. |
11. bit | &1024 | default is 0; exports the value either if exporting without values. |
!! Row, Col bits / object
FP
[0] GetAttr
Fast paste. Speeds up exporting to xlsx and html and copying to clipboard as html. It also controls some exporting behavior.
If set to
row, it can be set also as object with attributes as column
id or column
FID, e.g.
FE: { Col1:31, Col2:0, DefCol1:27 }.
&3 |
Error - what to set if the pasted value is not accepted:
0 - value is not set, original cell value is preserved,
1 - sets null,
2 - sets NaN,
3 - sets the first value from List otherwise empty string or 0.
|
&4 | If set, ignores ResultMask attribute. If set for List, ignores ListRelated. |
&8 | If set, ignores EditMask attribute. |
&16 | If set, ignores NoChanges attribute. |
&32 | If set, ignores Value attribute for testing changes in cell. |
Column id to read
FV,
FT,
FS,
FA,
FE from row if defined as object.
By default it is set to column
D.
id.
If set, ignores all attributes
FV,
FT,
FS,
FA,
FE.
Use especially for testing if the
Fx attributes are set correctly compared to normal settings.