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

Default rows

TreeGrid documentation

Every row <I> has predefined attribute values in its default row <D>. The values from <D> are used when the row <I> has some attribute not set. If row has attribute set to empty value, the default value is not used.
Using defaults helps you to reduce data size and also to control adding and moving rows. But using defaults is not required.
Using defaults is good especially for trees with different levels, at least to differentiate tree nodes and data rows.
Default rows are used for restrictions in dragging and copying rows in tree.

Defaults <D> are identified by their attribute Name. By this Name string are referenced from rows or other defaults by attributes Def or CDef.

Def attribute specifies default for the row itself.
You can use Def attribute even in <D> tag to reference one or more other <D>. This means that you define <I> that references to its <D> that references to another <D>, that ...
If you don't set Def attribute for any <D> or <I> tag the default is always <D Name="R">. Only for fixed rows is predefined <D Name="Fixed"> that references "R" default too. This means that any attribute value not set in branch of <I> and <D> tags is at last read from "R" default.
Pay attention to cross-references among <D> tags.

CDef attribute specifies default for all immediate children rows, but only if they have not set their own Def attribute.
When adding rows to children of the row, the new row will implicitly have default the same as parent rows' CDef.
You can use CDef attribute even in <D> tag to predefine CDef attribute for all rows that use this default (the CDef attribute does not concern <D> tag itself, unlike Def attribute).
The CDef attribute can be also set in tag <Root>, this specifies default for all root rows. In this case <Root> acts as parent for all variable root rows, including adding and dragging rows to root.

You can specify to row which default to use by many ways, all can be done in every case, but some are better for some cases and some for other cases.
Using Def attribute only is simpler but by CDef attribute you can control more. Remember, CDef attribute you can set even in <D> and <Root> tags too.

If you don't use any Def or CDef attributes, all variable rows will have default <D Name="R">, header rows <D Name="Header">, other fixed rows <D Name="Fixed"> and solid rows <D Name="Solid">. These <D> are defined in basic file Defaults.xml. It means, if you don't need to use defaults, you need not do it. You can change attributes of "R" or "Fixed" if you use <D> tag with this name in your data. New attributes you specify are merged or overwrite attributes specified in Defaults.xml => you don't need to edit this file for every new grid.

Example of default rows

This example show basic usage of default rows and Def and CDef attributes.

<Grid>
<Cols><C Name='A'/></Cols>
<Def>
<D Name='R' Expanded='0'/>
<D Name='Fixed' CanEdit='0'/>
<D Name='D1' AType='Int'/>
<D Name='D2' AType='Lines'/>
<D Name='D3' AcceptDef='D1,D3'/>
<D Name='D4' CDef='D3' Def='D2'/>
</Def>
<Root CDef='D4'/>
<Head>
<I/>
</Head>
<Body>
<B>
<I/>
<I Def='D1' CDef='D3'>
<I/>
</I>
</B>
</Body>
</Grid>



All rows in grid will be collapsed
All fixed rows in grid will be read only
This custom default sets type of column 'A' to integer
This custom default sets type of column 'A' to multiline text
This custom default permits dragging rows with Def='D1' and Def='D3' as children of rows that have Def='D3'
This custom default sets all children Def attributes to D3. And inherits all settings from D2.

All root variable rows without Def attribute will have set Def='D4'

Has Def='Fixed' (has AType='Text', because all undefined Type are 'Text')



Has Def='D4' because of setting Root CDef (has AType='Lines')
Has Def='D1' because of its own setting (has AType='Int')
Has Def='D4' because of its parent CDef setting (has AType='Lines')

Example of changing default row

This example shows updating row when it gets children and becomes parent row or looses its children and becomes empty.
The change can be done by adding new row, deleting row or moving row.

<Grid>
<Cfg MainCol="A"/>
<Cols>
<C Name="A" Width="500"/>
</Cols>
<Def>
<D Name="R" DefParent="Node" DefEmpty="Item"/>
<D Name="R" CDef="Item"/>
<D Name="Node" Color="220,220,200"/>
<D Name="Item"/>
</Def>
<Root CDef="Item"/>
<Body>
<B>
<I Def="Node" A="1">
<I A="1-1"/>
</I>
<I A="2"/>
<I A="3"/>
<I A="4"/>
</B>
</Body>
</Grid>






Any row if becomes parent its Def is set to "Node" and if becomes empty the Def is set to "Item".
Any row's new children will have set Def="Item". Any children without Def has Def="Item".
Parent row is colored, to show the change.


Any new root rows will have set Def="Item". Any root rows without Def has Def="Item".


It is parent row, so it has explicitly set Def="Node".
This child has set Def="Item" due setting <D Name="R" CDef="Item"/>.

This and next children have set Def=”Item” due setting <Root CDef="Item"/>.

Items related to default rows

<D> string

Name

required attribute
Name of the default row. Required. This name is referenced in row attributes Def, CDef, AcceptDef, DefEmpty, DefParent.
Any custom name can be used for default row, but there are predefined default row names (in Defaults.xml):
"R" - default row for all rows and defaults without Def attribute.
"Fixed" - default row for all fixed (head and foot) rows without Def attribute. Except Header. By default it inherits the Def "R".
"Solid" - default row for all solid space rows without Def attribute.
"Header" - default row for all Header rows.
"Group" - default row for all created grouping rows (parent rows automatically created when grouping). By default it inherits the Def "R".
In fact, any default with Group = '1' is default for grouping rows.
upd 10.0 <I><D> string

Def

["R"]
The name of default row <D> used for this row or default row. From this default the row inherits (reads) all its not set attribute values.
In <D> tag is this attribute is used only during loading data - fills the default by values from its parent default (and its parents).
Since 10.0 the <D Def/> can contain more default names, comma separated. But the <I Def/> can contain only one default!
If the <D Def/> derives from more default rows and they define the same attribute, the first default row listed in Def is used.
In space row it is not possible to define cells in the Def, use Mirror attribute instead.
API TRow var. TRow

Def

read only
On runtime the row Def attribute points to default row object instead of its name, the Def name is accessible by row.Def.Name.
upd 6.0 <I><Root> string

CDef

["R"]
The name of default row for row's children. This value is used as child's Def attribute value only for children without its own Def attribute set.
This attribute is used only on load, here it fills the row Def attribute value.
This value is also used as value of Def attribute for new child rows added to this parent.
The <Root CDef/> controls all root variable rows (like children of the hidden root row).
new 6.0 <I><Root> string[ ]

AcceptDef

Comma separated array of names of default rows that are accepted as children of this row.
Only rows with Def attribute present in this array can be moved or copied to the row's children.
If this attribute is missing, the row accepts all rows. If it is empty, it accepts no rows.
The <Root AcceptDef/> controls moving and copying into root (like children of the hidden root row).
new 6.0 <I> string

DefEmpty

Name of default row that will be set to row's Def attribute when the row loses all its children.
After change the row will be re-rendered to show all the changes related to the change.
This attribute is used only after the change (except if set InitDef), not on loading, on loading the row should have set correct Def attribute.
Hidden rows are valid children, but deleted rows (even visible) are not children!
new 6.0 <I> string

DefParent

Name of default row that will be set to row's Def attribute when the row gets first children and becomes parent row.
After change the row will be re-rendered to show all the changes related to the change.
This attribute is used only after the change (except if set InitDef), not on loading, on loading the row should have set correct Def attribute.
Hidden rows are valid children, but deleted rows (even visible) are not children!
new 15.0 <I> bool

InitDef

[0]
If set, assigns Def attribute according to DefParent and DefEmpty also on loading.
API variable TRow[ ]

Def

Named array of all default rows in grid, including the base defaults: "R", "Fixed", "Solid", "Header" and "Group".
To access or change some default attribute value use grid.Def[def_name].attribute.
To get some row attribute including default value use global function Get(row,"attribute").
upd 6.4 API method void

ChangeDef

(TRow row, string def, bool show = 1, bool undo = 0)
Changes Def attribute of the row to default named def. If show = 1 it refreshes row and shows the changes.
It does not update row values, so cell types should not be changed by switching to the new default or must be updated externally.
new 7.0 API event string

OnChangeDef

(TGrid grid, TRow row, string def)
Called when changing default row due DefEmpty and DefParent.
It is called before the change, def is name of the new default row.
Return different default row name to change it, or null to continue or empty string to suppress the change.
It is called from ChangeDef method.