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
FastGrid documentation
Search in documentation
FastGrid versions compatibility

Changes log (txt file) Compare FastGrid 1.0 & TreeGrid 17.1

Using in JavaScript frameworks

Angular Ember Express React Svelte Vue Other frameworks NodeJS server SalesForce LWC

Data and creating FastGrid

Simple examples of creating FastGrid Create FastGrid Display grid Access grid by API Sheets, more grids switched in one place Layout and configuration Data rows, columns, toolbars, images Changes in data rows, columns, toolbars Saving changes to server Mark changes Loading children on expand parent Short format

Layout - grid parts

Parts - ColParts and RowParts Part size Part scroll position Sets Column sets Row sets

Toolbars

Toolbar Cells Icon Height Width Toolbar position Dragging and manipulating cells Special toolbars

Rows and columns
Default rows, columns, cells, toolbars
Row and column identity

Row / column id Row / column index Row / column name

Row and column manipulation

API to get grid objects Auto added columns & rows on scroll Blocks of rows / columns Adding / copying / moving Deleting Showing and hiding Layout menu Selecting rows and columns Fill cell values by dragging Locking grid against changes Undo & redo

Row and column tree

Row and column tree Row tree Column tree Expand & collapse

Cells
Cell values and attributes

Read and write any values by API Cell value Cell attributes Cell value & attributes in UTF8 Store

Editing cells

Editing During editing Validation and errors

Cell images

Row cell side icons Icons definition Mark icons and charts Mark icons list Row cell floating images

Cell size

Row height Column width Resizing rows and columns Padding Margin Cell span

Cell style

Grid style and look Cell style permissions Cell style Cell outer border Cell inner border Alternate row & column background

Other cell features

Cell hyperlink Cell tooltip Static cells Other cell attributes Row & column attributes to speed up

Cell types and formats
Cell type and format Range - more values / ranges in cell String type Html type Auto type
Bool type

Bool type Check side icon Bool type & Check side icon

Number type

Format Localization

Date type

Format Localization Calendar

Calculations - formulas
JavaScript formulas

JavaScript formulas Aggregate functions String aggregate functions Other functions

Editable formulas

Formula rules Formula attributes Defined names for editable formulas Conditional functions Lookup functions Cell reference functions Logical functions Informational functions Mathematical functions Trigonometry functions Rounding numbers Number conversions String functions Date functions Summary functions

Dialogs and menus

Dialog Dialog Place Dialog API Menu definition in Script Cell menu List Suggest

Features
Sorting rows / columns

Sorting Sorting settings Comparing strings

Grouping rows / columns

Grouping Grouping settings Comparing strings Pivot grid

Filtering rows and columns

Filtering Filter settings Comparing strings

Search in cells Import files to grid
Export files

Export files Export and copy to clipboard CSV data

Copy & paste via system clipboard

Copy & paste Copy to clipboard Paste from clipboard

Printing

Print Print to PDF

Global grid settings
Grid size & scroll

Grid size Grid scrollbars Paging and view Media rules - responsive design

Saving settings in storage or cookies
Focus and hover cells

Focus cell and cell ranges Mouse hover cells Highlight cells, rows and columns

Events

Mouse events Key events API events

Language

Translation Languages

Messages

Message Message style

Other API

API for iterating rows and columns Paint and repaint Various API methods

Debug & files

Debugging FastGrid files

UTF8 Store - fast & short data
Introduction - License & download

Basic description Main advantages Basic usage License Download Documentation

Script language implementations

JavaScript C# JAVA PHP

Suggested ucodes

Bits - small integers or enums Integers or enums with strings Date and time Floating point numbers Special strings

Basic ucodes

Integer 1 char String 1 char Date 1 char Bits 1 char Integer 2 chars String 2 chars Date 2 chars Float 2 chars Integer 3 chars String 3 chars Date 3 chars Integer and double float 5 chars String 5 chars Date 5 chars Fixed length string Separated strings Adjacent strings Prefix for escaping string Fixed length data Unused custom codes Prefix for stored separator or length Prefix for stored base number Unused basic ucodes

Complex ucodes

chars signed decimals multiple limits varstrings escape base chars2 signed2 decimals2 multiple2 limits2

Internal coding Profiling times for ucode options Function reference

Events

FastGrid documentation

Mouse events

Actions bool

On{Prefix}Click{Target}

(Grid Grid, Row Row, Col Col, Event Event) GetTagAttr SetTagAttr
Called on click to grid. The handler is set in Actions tag attribute as JavaScript code in string (e.g. OnClick: "alert('Clicked '+(Row&&Row.id)+','+(Col&&Col.id))") or as function(Grid,Row,Col,Event){...}, e.g. OnClick: function(Grid,Row,Col,Event){ alert('Clicked '+(Row&&Row.id)+','+(Col&&Col.id)); }.

{Prefix} is key prefix and / or mouse button name.
It can be Shift / Ctrl / Alt / Meta / Right / Middle or they combination in this order, e.g. OnShiftRightClick: "alert('click')".
Left mouse button is without prefix by default.
The prefix names are defined in Actions tag, attributes ShiftPrefix, CtrlPrefix, AltPrefix, MetaPrefix, LeftPrefix, RightPrefix, MiddlePrefix.

{Target} is event target or Button name, there are four steps called in this order:
a) Tool for toolbar cell or Cell for normal cell or Disabled for Disabled cell or toolbar cell.
b) empty for any click.
c) button for clicked Button name or one of predefined icon and button names listed below. It is ignored if empty.
d) Any for any click.

Predefined button names for {Target} c):
Cells: Link (attribute Link), Date (Type Date), Bool (Type Bool),
Cell icons: List, Check, Filter, SelectRow, SelectRows, SelectCol, SelectCols, DeleteRow, DeleteRows, DeleteCol, DeleteCols, AddRow, AddRows, AddCol, AddCols, CollapseRow, CollapseCol, CollapseRowLevel (cell buttons for LevelsPart),
Sort icons: SortVert (sort icon in header row for SortIcons<=2), SortUp (sort up in header row), SortDown (sort down in header row), SortHorz (sort icon in header column for SortIcons<=2), SortLeft (sort left in header column), SortRight (sort right in header column),
Tool icons: all toolbar cells with D Icon have predefined Button as the cell id,
Other: Image (image in Images), FocusEdge (edge of focus cursor), FocusCorner (corner in focus cursor), FocusAll (top left grid corner), CollapseColLevel (Levels button in Tree column part), CollapseCol (expand / collapse button in Tree column part),

The order of calling the event handlers: OnPrefixClickTool or OnPrefixClickCell in cell and next in Actions, OnPrefixClick in cell and next in Actions, OnPrefixClickButton in cell and next in Actions, OnPrefixClickAny in cell and next in Actions, OnClickTool or OnClickCell in cell and next in Actions, OnClick in cell and next in Actions, OnClickButton in cell and next in Actions, OnClickAny in cell and next in Actions.
For Disabled cell there are called only: OnPrefixClickDisabled in cell and next in Actions, OnClickDisabled in cell and next in Actions.

The default actions are assigned to Actions tag in Defaults.js.

By default it is called also for pressing keys Enter and Space, because their default assigned handler calls action ClickButton.
Cell, Tool bool

On{Prefix}Click{Target}

(Grid Grid, Row Row, Col Col, Event Event) GetAttr SetAttr
Called on click to the grid cell or toolbar cell. The handler can be set as the row, column, cell, toolbar or toolbar cell attribute as JavaScript in string or function, see Actions OnClick.
It is called after API OnClick, but before Actions OnClick, during processing the event. Return true to cancel the event and stop its propagation.
The {Prefix} and {Target} are the same as in the Actions OnClick.
API event bool

OnClick

(Grid grid, Row row, Col col, int x, int y, Event event, string prefix)
Called on click to grid cell or any other grid part except some parts of scrollbar.
It is called before the event is processed. Return true to cancel the event and stop its propagation.
Row is clicked row or toolbar. It can be null if clicked outside cells.
Col is clicked column or toolbar cell. It can be null if clicked outside cells.
x, y is click position inside cell.
Event is FastGrid event with various information. The original DOM mouse event is accessible by event.Event.
prefix is set for pressed Shift/Ctrl/Alt/Meta keys as their names and for other mouse buttons /Right/Middle (for left mouse button is empty by default), for more key or button prefixes they are joined in this order, e.g. "ShiftCtrlRight".
Actions bool

On{Prefix}DblClick{Target}

(Grid Grid, Row Row, Col Col, Event Event) GetTagAttr SetTagAttr
Called on double click to grid. The handler is set in Actions tag attribute as JavaScript code in string (e.g. OnDblClick: "alert('Double clicked '+(Row&&Row.id)+','+(Col&&Col.id))") or as function(Grid,Row,Col,Event){...}, e.g. OnDblClick: function(Grid,Row,Col,Event){ alert('Double clicked '+(Row&&Row.id)+','+(Col&&Col.id)); }.
It is not called if the OnClick event was processed and cancelled by some successfull event handler.
The {Prefix} and {Target} are the same as in the Actions OnClick.
Cell, Tool bool

On{Prefix}DblClick{Target}

(Grid Grid, Row Row, Col Col, Event Event) GetAttr SetAttr
Called on double click to the grid cell or toolbar cell. The handler can be set as the row, column, cell, toolbar or toolbar cell attribute as JavaScript in string or function, see Actions OnDblClick.
It is called after API OnDblClick, but before Actions OnDblClick, during processing the event. Return true to cancel the event and stop its propagation.
It is not called if the OnClick event was processed and cancelled by some successfull event handler.
The {Prefix} and {Target} are the same as in the Actions OnClick.
API event bool

OnDblClick

(Grid grid, Row row, Col col, int x, int y, Event event, string prefix)
Called on double click to grid cell or any other grid part except some parts of scrollbar.
It is not called if the OnClick event was processed and cancelled by some successfull event handler.
It is called before the event is processed. Return true to cancel the event.
Parameters are the same as OnClick.
Actions bool

On{Prefix}Drag{Target}

(Grid Grid, Row Row, Col Col, Event Event) GetTagAttr SetTagAttr
Called on start dragging in grid. The handler is set in Actions tag attribute as JavaScript code in string (e.g. OnDrag: "console.log('Start dragging '+(Row&&Row.id)+','+(Col&&Col.id))") or as function(Grid,Row,Col,Event){...}, e.g. OnDrag: function(Grid,Row,Col,Event){ console.log('Start dragging '+(Row&&Row.id)+','+(Col&&Col.id)); }.
It is not called if the OnClick event was processed and cancelled by some successfull event handler.
The {Prefix} and {Target} are the same as in the Actions OnClick.
Cell, Tool bool

On{Prefix}Drag{Target}

(Grid Grid, Row Row, Col Col, Event Event) GetAttr SetAttr
Called on start dragging in the grid cell or toolbar cell. The handler can be set as the row, column, cell, toolbar or toolbar cell attribute as JavaScript in string or function, see Actions OnDblClick.
It is called after API OnDrag, but before Actions OnDrag, during processing the event. Return true to cancel the event and stop its propagation.
It is not called if the OnClick event was processed and cancelled by some successfull event handler.
The {Prefix} and {Target} are the same as in the Actions OnClick.
API event bool

OnDrag

(Grid grid, Row row, Col col, int x, int y, Event event, string prefix)
Called on start dragging grid cell or any other grid part except some parts of scrollbar.
It is called before special dragging events like OnStartDrag.
It is called before the event is processed. Return true to cancel the event.
Parameters are the same as OnClick.

Key events

Actions bool

On{Prefix}{Target}

(Grid Grid, Row Row, Col Col, Event Event) GetTagAttr SetTagAttr
Called on key down of key {Target}. The {Target} is the key name defined in Actions tag in KeyCodes, by default in Defaults.js, e.g. OnEnter or OnCtrlK.
Predefined key names by their key codes:
Space: 32, Enter: 13, Esc: 27, Backspace: 8, Tab: 9, CapsLock: 20, ScrollLock: 145, NumLock: 144,
Tilde: 192, Minus: 189, Equal: 187, Backslash: 220, LeftBracket: 219, RightBracket: 221, Semicolon: 186, Apostrophe: 222, Comma: 188, Point: 190, Slash: 191,
F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123,
Ins: 45, Del: 46, Home: 36, End: 35, PageUp: 33, PageDown: 34, Up: 38, Down: 40, Left: 37, Right: 39, Pause:19,
NumDivide: 111, NumStar: 106, NumMinus: 109, NumPlus: 107, NumPoint: 110, Num0: 96, Num1: 97, Num2: 98, Num3: 99, Num4: 100, Num5: 101, Num6: 102, Num7: 103, Num8: 104, Num9: 105

{Prefix} is key prefix. It can be Shift / Ctrl / Alt / Meta or they combination in this order, e.g. OnShiftCtrlEnter: "alert('pressed enter')".
The prefix names are defined in Actions tag, attributes ShiftPrefix, CtrlPrefix, AltPrefix, MetaPrefix.

The default actions are assigned to Actions tag in Defaults.js.
Return true to suppress default action for the key event.
Cell, Tool bool

On{Prefix}{Target}

(Grid Grid, Row Row, Col Col, Event Event) GetAttr SetAttr
Called on key down when the cell has focus (focused cell can be got by GetFocus).
It is called after API OnKeyDown, but before Actions On{Prefix}{Target}, during processing the event. Return true to cancel the event and stop its propagation.
The {Prefix} and {Target} are the same as in Actions On{Prefix}{Target}.
API event bool

OnKeyDown

(Grid grid, int key, Event event, string name, string prefix)
Called on key down when grid has focus. It is called before the event is processed. Return true to cancel the event.
Grid receives focus on click or when calling SetFocus or SetFocused API methods.
key is DOM key event keyCode.
event is FastGrid key event. The original DOM mouse event is accessible by event.Event.
name is FastGrid key name defined in Actions.KeyCodes. If the key has not assigned name, the name is character from key unicode.
prefix is set for pressed Shift/Ctrl/Alt/Meta keys as their names, for more key prefixes they are joined in this order, e.g. "ShiftCtrlMeta".

API events

API events are user defined JavaScript methods called from FastGrid code in various situations. Every API event has defined its specific parameters.
The individual API events are described in various places in the documentation, along with the related features.
This paragraph descibes defining and assigning API event handlers.

FastGrid API event handlers can be assigned in three ways:
1) Defined in input JSON in tag Events like: Events:{ OnClick: function(Grid,row,col,X,Y){ alert("Clicked "+row.id+","+col.id) } }
2) Directly set in JavaScript to global FGrid object like: FGrid.OnClick = function(Grid,row,col,X,Y){ alert("Clicked "+row.id+","+col.id); }
3) Assigned in JavaScript by API method AddEvent like: grid.AddEvent("OnClick",function(Grid,row,col,X,Y){ alert("Clicked "+row.id+","+col.id));
These ways must not be combined for the same event!
Grid method string / int

AddEvent

(string event, function func, string ident = null)
Adds function func as hander for event.
For example: grid.AddEvent("OnClick",function(Grid,row,col,X,Y){ alert("Clicked "+row.id+","+col.id),1); ident is the handler custom unique identifier. If there was already added handler for the event with the same ident, the old handler is removed.
If the ident is null, it adds the handler under new unique identification and returns the identification.
Returns the ident or null if input parameters are incorrect. It does not check if the name is valid FastGrid event name.
It cannot add event handler if it is already assigned in Events in JSON or directly in FGrid.
Grid method bool

DelEvent

(string event, string ident = null)
Deletes event handler added by AddEvent with the same event and ident.
If ident is null, removes all handlers for the event.
Returns true for success and false if there was no such handler to remove.
It can delete event handlers defined by any of the three ways described above.
Grid method void

DisableEvent

(string event)
Temporary removes all handlers added for given event.
It can disable event handlers defined by any of the three ways described above.
Grid method void

EnableEvent

(string event)
Enables the event handlers temporary disabled by the DisableEvent.