News in version
TreeGrid Gantt chart SpreadSheet Examples Documentation Download Development Licensing Prices References Contacts Buy Try it free
Documentation
Search in documentation
TreeGrid versions compatibility

Changes log (txt file) Using custom CSS from 13.3 to 14.0 Upgrading from 9.3 to 10.0 Upgrading from 5.9 to 6.0

Using in JavaScript frameworks

Angular React Vue Other frameworks NodeJS server

Creating grid

Simple examples Basic information Creating grid Deleting grid Reloading grid Rendering grid Accessing grid by API

Data & communication
Data communication with server

Communication types AJAX communication AJAX SOAP envelope Submit communication Directly included data Data from JavaScript Cross domain / local load by JSONP Sessions (AJAX) Server response (AJAX) Synchronous communication (AJAX) Caching (AJAX) API (AJAX)

Download data

Settings for data download Layout XML structure Data XML structure

Upload data

Settings for data upload API for upload XML structure sent to server

Changing data from server

XML structure of download changes XML structure of request for a cell Synchronizing data with server

Input / output data formats

Complete list of tags Internal XML format Short XML format Extra short XML format DTD XML format JSON format

Cells
Cell basics

Cell type Cell format Dynamic format Dynamic type Cell value Reading / writing attributes by API Cell HTML Cell default Range or more values in one cell Cell with link URL Cell hint Cell tooltip / title Cell popup menu

Cell editing and changing values

Cell editability Dynamic editing Locking Defaults list Suggest list (auto complete) Tags input Changing cell value Mass cell change Clearing cells Editing cells Controlling <input> tag by JavaScript Input validation and restrictions Side checkbox Cell selecting

Calculations - cell formulas

Basics Formulas Mathematical functions Aggregate functions Special functions for actions Custom functions

Calculations - editable cell formulas

Basics Suggest list (auto complete) Defined names Actions for choosing cells 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 Custom functions

Cell side buttons

Introduction Right side Button Left side Icon

Cell spanning

Column span Row span Dynamic spanning

Cell style and color

Basic grid style Sizing and scaling - responsive design Dynamic cell style attributes Cell CSS class Cell background color Dynamic cell border Cell HTML style Row color alteration Cell mouse cursor

Editable cell images

Insert image Edit image

Cell types
Automatic type - Auto String - Text, Lines & Pass
Number - Int & Float

Format Localization

Date and time - Date

Format Calendar component Dates dialog Localization

List & combo - Enum & Radio

Introduction Definition Related lists Enum specific Radio specific

Checkbox - Bool
Action button - Button

Introduction Basic clickable button Switch button Radio / tab button Menu button Combo switch button Combo radio / tab button Special Space rows with buttons

Panel with more buttons - Panel

Definition Standard fast panel Custom panel

HTML and special types

Html type EHtml type (editable) Icon type Abs type List type Editable Link type Editable Img type DropCols type Upload File type

Columns

Column basics Column index Column visibility Column visibility menu Column selecting Column tree Auto column tree Column position and moving Column adding and copying Column deleting Column width Column API

Rows
Row basics

Rows by functionality Rows by position Row name Row id Row index

Default rows

Description Example of default rows Example of changing default row Attributes

Row tree

Tree attributes Actions & API for expand / collapse

Row identification

Setting row id attribute Row id attribute in tree Row id created from cell values API for row ids

Row visibility
Row adding and copying

Five ways of adding rows to grid Adding and copying restrictions Adding new empty rows Copying existing rows

Row deleting Row moving and dragging Row selecting Row height Row API Space rows
Features
Sorting rows

Sort settings Controlling sort position Comparing strings Sorting actions Sorting API

Grouping rows to tree

Group settings Creating groups Comparing strings Created group rows <D Group='1'/> User interface to choose grouping Grouping actions and API

Filtering rows

Filter settings Comparing strings User interface to choose filter Filter actions and API

Searching in rows and cells

Search settings User interface for search Search actions and API

Printing grid

Print settings Choosing items to print Page size Print API

Print / export to PDF

Introduction Client side settings Printing options Client side API Server side API Data sent from client to server

Export to Excel or CSV

Introduction and export types Basic settings Styling export XLSX export Gantt export CSV export Old XLS / XHTML export Export API Communication with server Client export Server export

Import from Excel

Basic settings Sheets manipulation

Copy & paste rows via clipboard

Copy & paste permissions Copying to clipboard Pasting from clipboard

Master - detail grids

Introduction External master - detail grids Nested master - detail grids Synchronizing grids Other attributes for master - detail

Pivot tables

Pivot attributes & API Pivot formulas

External objects (like Adobe Flash) Undo & Redo
Gantt and bar chart
Gantt objects

Gantt objects list Display settings Edit settings

Main bar

Definition of main bar and plans Main bar as Task Edit settings Main bar content and side html Tip on mouse hover Vertical position and height Style specific attributes API to manipulate Main bars Actions Side text (deprecated) Real Flow (deprecated)

Run bar

GanttRun Definition Extended definition Run bar as Task Edit settings Save format Selecting Run boxes Run box content and side html Tip on mouse hover Box identification Vertical position and height Style specific attributes Overlaid (Error) boxes Containers for more boxes Dragging - moving and resizing API to manipulate Run boxes Actions Run special formulas

Summary task

Main for Main Main for Run Editable Main Editable Run

Gantt icons - Flag & Point

Flag - icon with text Point - math points

Gantt display objects

Header - column captions Cell and column Background Vertical movable Line Mark & Progress line

Gantt zoom

Zoom options Chart size limits Zoom selection Paging in Gantt chart

Dependency, constraints & schedule

Introduction Data units Defining dependencies Dependency colors and shapes Changing dependencies Correcting dependencies Scheduling algorithm Project date constraints Task date constraints Critical path - Slack (Float)

Gantt calendars

Global base calendar Local calendar Calendar list Calendars dialog Other settings

Gantt resources

Resources list Resources assign Resources filter Resources calculations Availability chart Resource usage chart Generated resource usage chart

Gantt popup menu Gantt API
Line and XY points charts

Charts in grid cells Chart JSON definition Base chart settings Basic attributes Size Axis and caption Individual chart lines Data sources Visual settings API for standalone usage

Paging in large grids
Paging root rows

Paging types and attributes Auto adding root pages API for paging

Pager components

Side pager Side pager type Pages Side pager type Gantt Side pager type Custom Pager with navigation buttons & edit Pager as list of page indexes

Paging in tree

ChildPaging - load / render on expand MaxChildren - limit children count ChildParts - load / render on scroll

Paging columns

Paging types and attributes Auto adding column pages API for column paging

Server paging

Server paging for root rows Server communication in root paging Root paging in very large tables Server paging in tree Server communication in tree paging XML Request for Data in root paging XML Download Data in root paging XML Request for root Page / children XML Download root Page / children API for server paging

TreeGrid DLL/SO for server paging

Introduction Compatibility with TreeGrid control Using TreeGrid server DLL/SO ASP.NET C# ASP.NET VB PHP JSP Java TreeGrid server concepts Function reference Calculations

JSON menus and dialogs
JSON menu description JSON menu definition example
Menu settings

Base attributes Visual settings Key navigation Behavior Size and scroll

Menu item settings

Base attributes Clickable item Inactive caption Collapsible sub level Popup sub menu Columns Bool item Enum item Edit item

Custom menu in JavaScript

Show custom menu Custom menu position Custom menu advanced settings Custom menu JavaScript events Custom menu JavaScript methods

Calendar dialog Custom calendar & JavaScript events Custom dialog in JavaScript
Global grid settings
Grid size and scroll

Default behavior Maximize grid height and width Update size according to the content Let a user to control the grid size Widths of individual sections Other scrolling attributes and API

Media rules - responsive design
Languages

Language & regional setup (Text.xml) Translate texts dynamically Change language

Grid cursor - Focus & hover

Focused cell and row Focused cell range Move and copy focused cells Filling cell values by dragging Tabulator navigation Key navigation Cursor look - focus & hover

Selecting rows, cells and columns

Selecting base Selecting rows Selecting cells Selecting columns

Global settings

Status messages Configuration menus Configuration menu - options Configuration menu - columns Configuration menu - print / PDF Configuration menu - export Default toolbar Useful API function Help file

Animations

Animations base Row animations Column animations Cell animations Animations for undo / redo Animations for server side changes Dialog animations

Grid configuration in cookies
Mouse & key events & actions

List of event handler types TreeGrid mouse events Mouse event names Key and mouse button prefixes Touch event names Event targets Assigning event actions / callbacks Event action parameters Action name suffix Calling actions from JavaScript Creating custom actions Focused vs. Actual cell TreeGrid key events JavaScript API events

Mouse API event TreeGrid files
Debugging and testing

Debug window Automated testing

Column width

TreeGrid documentation

Every column can have set its width by Width otherwise its width is automatically calculated on start, but it can slow down the grid.
Every column's width can be also automatically calculated to fill all the main tag, set it by RelWidth.
Columns can be resized by a user, by mouse dragging.
Space row cells are independent on columns and have set their Width attributes.
<C> int

Width

Saved to cookies, avoid it by <C WidthLap='1'/>
Column width in pixels. It is outer width including all side buttons, cell border and padding.
If it is not set, it is automatically computed before the grid is first displayed according to the width of first few cells in the column.
If there any many columns, the automatic width calculation can slow down the rendering, so you should set Width for all or most of them!
If the cell content is wider than column width, it is overflowed in normal cells and wrapped in multiline cells (Type=Lines, Html, ...).
<C> int

RelWidth

If set, the column width is automatically computed to fill all the remaining space in main tag.
The width is automatically recalculated whenever the width of the main tag or its content changes.
If there are more RelWidth columns in grid, their width is computed as ratio of their RelWidth values.
The RelWidth columns together fill the remaining vertical space in main tag, so the grid has always constant height of the main tag.
Using too many RelWidth columns can remarkably slow down grid usage!
You can set <fg ShowVScroll='1'/> to always show vertical scrollbar to speed up grid, especially in tree.
You can set minimal width by MinWidth.
It is ignored when set <Cfg NoHScroll or MaxHScroll or NoScroll /> attribute.
If the RelWidth column is resized by a user, it looses its capability and gets fixed width. Back to relative width can be forced by resizing it to zero width.
For successful printing set PrintWidth for the relative width column.
new 11.0 upd 12.0 <C> int

RelWidthType

[0]
Changes RelWidth behavior. Bit array.
1. bit&10 - Resizes the column to fill the main tag (the whole grid)
1 - Resizes the column to fill its column section, the LeftWidth / MidWidth / RightWidth.
2. bit&2(new 12.0) If set with 1.bit, it shrinks the column until the column section hides its scrollbar.
3. bit&4(new 12.0) If set with 1.bit, it never hides column with MinWidth. If not set, it hides the column if it would be narrower than MinWidth.
4. bit&8(new 12.0) If set with 1.bit, it also resizes the column to fill the main tag (the whole grid) width.
new 12.0 <C> bool

ConstWidth

[0]
Empty relative width column. Useful to automatically maximize column section (with RelWidthType='1') or the whole grid (with RelWidthType='0').
By default it is created by <Cfg ConstWidth/>.
It is completely inactive, with special empty CSS class.
<C> int

MinWidth

Minimal width for width calculated on start (no Width set), for width calculated by RelWidth and for column resizing by a user.
If not set, minimal column width is cell border + padding.
If not set or set less than 20, resizing column by a user below the MinWidth sets the column to automatic width and calculates it according to its content.
new 13.2 <C> int

MaxWidth

Maximal width for width calculated on start (no Width set), for width calculated by RelWidth and for column resizing by a user.
<C> bool

OverflowEllipsis

Removed, used "text-overflow:ellipsis;" in ...Grid.css file.
upd 7.0 <C> int

GroupWidth

A width of column when it is set as main column to show tree when grid is grouped.
You can specify this width to change column width when it becomes main column while grouping - to resize column to accommodate the tree.
When grid is ungrouped or it shows the tree in another column, the column width returns to previous setting.
Since 7.0, if set to 1, the width of the column will be automatically increased by the widths of columns hidden by grouping.
new 13.0 upd 15.0 <Cfg> int

Overlay

[0]
If and how the overlaying empty cells is done in the grid.
If set, permits using column attribute Overlay to overlay empty cells like in MS Excel.
Values 2 and higher can slow down the grid!
0 - No overlay is done.
1 - Simple fast overlay, default border remains between overlaid cells, all cells are overlaid to right. Row spanned cells cannot overlay next cells.
2 - Like 1 and border between overlaid cells is cleared.
3 - Like 2 and also overlays right aligned cell to left instead of right. And since 15.0 also centered cells to both sides.
3. bit &4 - since 15.0 permits overlay of row spanned cells (but without col span).
4. bit &8 - since 15.0 if two cells overlay the same next cell, the second overlay is restricted; if not set, the next cell value displays mangled value of the both overlay cells (e.g. A='long value, will not overlay B if 4. bit set ' B='' C='long value' D='will contain rest of A and C values overlaid if 4. bit not set').

Due internal implementation the overlaid (empty) cell can show overlapped (mangled) values from more than one cell even with Overlay=15 in these cases:
- If two cells overlay to the same (empty) cell and at least one from the two cells is row spanned.
- If right and left aligned cells overlay to the same (empty) cell and the values are shorter and do not overlay to the other overlay cell.
new 13.0 upd 14.0 <C> <cell> int

Overlay

[0]
If the cell value can overlay next cells and if previous cell value can overlay this cell. Bit array. Used only if set <Cfg Overlay>
1. bit &1 - If the cell value can overlay next cells if it is wider than the cell width.
2. bit &2 - If previous cell will not overlay this cell if it has some value.
3. bit &4 - If set with 2.bit, the cell will not be overlaid either if it has empty value.
4. bit &8 - (new 14.0) It overlays also wrapped cells - the cell is extended horizontally if possible, rather than vertically. Requires <Cfg Overlay=2 or 3. For right aligned cells it is done always even without the 4. bit set.
Standard value for MS Excel like behavior is 3.
It never overlays: cells with side buttons, main column, cells between column sections, header and filter rows, cells spanned in both directions. In Chrome it does not overlay cells between column pages.
The cells overlaying next cells are ignored when calculating column width automatically.
new 15.0 <Cfg> int

OverlayImg

[1]
If the cell images can overlay next cells in both directions.
0 - no
1 - only the floating images set by Img attribute
2 - also values of type Auto or EHtml with <img> tag and containing single <img> and white space
3 - also values of type Auto or EHtml with <img> tag and containing only <img> tags and white space
4 - also values of type Auto or EHtml with <img> tag and containing <img> tags and any other content
new 12.1 <C> int

Overflow

[0]
Use to speed up large grids with many cells on WebKit browsers (Chrome, Safari, Opera).
There is a bug in WebKit engine that causes the more tags with overflow:hidden is on page, the slower is every re-flow action on page.
You can define Overflow for all columns that are enough wide to show all theit content, so they don't need to overflow their cells content.
0 - Hidden, sets overflow:hidden to all column cells except empty. Standard, but slow.
1 - Visible, sets overflow:visible to all column cells. Fast, but the wider cell value overflows to next cell(s).
number - sets overflow:hidden to all cells if the column has Width < number or sets overflow:visible to all cells if the column has Width > number.
It does not affect Header and Filter rows, they always use overflow:hidden.
<C> bool

CanResize

[1]
If column can be resized by a user by mouse dragging by column's right edge. The column resizing must be also permitted globally by <Cfg ColResizing='1'/>.
If set to 1, fixed column can also be resized automatically if there is no room for it, to preserve displaying "Too small extents" message.
<Cfg> bool

ColResizing

[1]
All columns that have set <C CanResize='1'/> can be resized by a user.
new 11.0 <C> <cell> int

Resizing

[0/2]
If the cell checks its edges for mouse actions, bit array.
Default value is 2 for Header rows and 0 for other rows.
0 - no edge
1 - top and bottom edge for row resizing, event target is HeaderTop and HeaderBottom
2 - left and right edge for column resizing, event target is HeaderLeft and HeaderRight. Cannot be set for Space cell.
3 - both vertical and horizontal edges.
new 7.0 <C> int

VarHeight

[0]
Set to columns containing wrap able cells, to shrink row height when the column is resized by a user and cells values occupy less height.
For 1 the rows are resized after column resizing finishes.
For 2 it resizes the rows during column resizing, it can be slow and should be used only for small grids.
This attribute also affect printing, see VarHeight.
new 10.0 <C> int

MaxCalcWidth

[100]
Maximal count of rows to iterate when calculating column width.
Increasing the value can slow down the action.
<Space cell> int

Width

[100/-1]
Width of the Space cell in pixels. If not set, it has default value 100 and for Button and Label has -1. It is inner width without side buttons and border and cell padding.
It can be set to -1 to automatically calculate width according to cell content every time. If the cell value is changed, its width is updated.
It can be set to -2 to automatically calculate width according to cell content first time.
new 13.0 <Space cell> int

MinWidth

Minimal width of the cell for Width = -1 or -2. In pixels.
new 13.0 <Space cell> int

MaxWidth

Maximal width of the cell for Width = -1 or -2. In pixels.
new 13.0 <Space cell> int

MinEditWidth

[10]
Minimal width of the tab cell if edited. In pixels. Usually used for renaming sheet.
<Actions>

ColResize

Mouse dragging action, only for OnDrag... event
Starts resizing column by mouse. This actions resizes also right side Pager.
By default is the action attached to OnDragHeaderLeft (header left edge), OnDragHeaderRight (header right edge) and OnDragPagerHeaderRight (right side pager header right edge).
API event void

OnColResize

(TGrid grid, string col)
Called when column is resized, by a user or due RelWidth or by API call SetWidth.
It can be called more times during resizing column by a user, for every change.
new 6.3 upd 9.2 API event void

OnAfterColResize

(TGrid grid, string col, TRow row, int chg)
Called after column or right pager is resized by a user. Called only once.
(Since 9.2) row is the header row where the column edge was dragged.
(Since 9.2) chg is change of width in pixels.
API method void

SetWidth

(string col, int dx)
Changes column with about dx pixels. Displays the change in grid.
The dx can be positive (enlarge) or negative (shrink). The resulted column width will be grid.Cols[col].Width + dx.
If the resulted width will be less than MinWidth, the column width is automatically calculated according to its content or it restores RelWidth if it was set.
upd 13.2 API method void

CalcWidth

(string col, bool noupdate = 0, TRow[] rows = null)
Computes column width according to the first 100 (set by MaxCalcWidth) visible cells in this column, including all fixed cells and header.
In server paging if no rows are loaded yet it uses only fixed cells for calculation!
Since 13.2 if set rows it checks all these rows instead of the first 100. The rows array can be got by GetShownRows to check actually visible rows.
By default updates the column width in grid, if set noupdate = 1, it just sets the Width attribute.
This method is called on start for every column that has not set Width or RelWidth.
new 10.0 API method int

TestCellWidth

(TRow row, string col = 0)
If the cell shows its content fully. Works only for already rendered cell.
Returns required change of the column width to show the whole cell content. Returns only 0 or positive value.