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

Changes log (txt file) Compare FastGrid 1.0 & TreeGrid 17.1 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 Ember Express React Svelte Vue Other frameworks NodeJS server SalesForce LWC

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 (custom JavaScript objects) 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

How to run TreeGrid Angular examples

0) Run and test TreeGrid Angular examples (optional)

Download TreeGrid examples package from http://www.treegrid.com/Download#Trial and unzip it to some directory, preserve its directories structure.

Angular examples per Angular version

TreeGrid examples package contains simple examples for Angular framework located in /ExamplesNode/Angular/. There are examples for different Angular versions.
The most of examples create TreeGrid statically by <treegrid> tag and the examples with -dynamic suffix create TreeGrid dynamically by TreeGrid() function.
  • Go to directory according to chosen Angular version, e.g. to /ExamplesNode/Angular/V19/
  • Run here command npm install to install the node modules and wait until they are installed.
  • Next run npm start to serve the example and wait until it is compiled (shows message in console: Compiled successfully).
  • Finally navigate your browser to http://localhost:4200/ to run the examples.

Optionally install and run sample NodeJS server that serves data for the Angular example from SQLLite database.

  • Go to directory /ExamplesNode/Server/.
  • Run here command npm install to install the node modules and wait until they are installed.
  • Next run npm start to start the NodeJS server. The server serves at http://localhost:8000/.



Using TreeGrid in Angular project



Installation

1) Copy TreeGrid distribution (/Grid)

Copy TreeGrid required files from TreeGrid examples package to the Angular project. The TreeGrid examples package can be downloaded from http://www.treegrid.com/Download#Trial
  • Copy the whole /Grid directory, including all subdirectories, from TreeGrid package to your Angular project.
    The destination location can be chosen freely, it just must be accessible for the Angular server for reading.
    In Angular 5 and older it must be copied into /src directory or some its subdirectory!
    It can be also shared among more Angular projects if the location is accessible for all the project servers.
  • Optionally copy the whole /GridSrc directory, including all subdirectories, from TreeGrid package to your Angular project.
    If you plan to modify TreeGrid css files and want to link the source css files to TreeGrid for simpler debugging.
  • Optionally if you purchased the debug sources, copy the whole TreeGrid debug sources package, including all subdirectories, to your Angular project.
    If you want to include the TreeGrid plain sources instead of compiled GridE.js file for easy debugging.
    Remember, the TreeGrid source files must not be accessible outside your company!.

2) Add paths to static files (assets)

Modify angular.json (or .angular-cli.json in 5.x and older), add to assets array all the files and directories that will be served directly without processing them by Angular.
Note that there can be more assets sections in angular.js, e.g. for "build" and "test", modify all of them.
In Angular 5 and older the served static files must be inside /src directory or some its subdirectory!
  • Add here path to /Grid directory where are the required TreeGrid files (copied in point 1)), for example add { "glob": "**/*", "input": "../../Grid/", "output": "/Grid/" } to serve directory "../../Grid/" as "Grid/".
    The input is relative to root directory with angular.json file, the output is relative to the served root with index.html.
  • Optionally add here path to GridSrc directory if you plan to modify TreeGrid css files and want to link the source css files to TreeGrid for simpler debugging, for example add { "glob": "**/*", "input": "../../GridSrc/", "output": "/GridSrc/" }.
  • Optionally add here path to TreeGrid debug source files directory if you purchased the sources and want to include the TreeGrid plain sources instead of compiled GridE.js file for easy debugging.
  • Add here path to TreeGrid static layout and data files if you use them and they are not located in the assets directory, for example add { "glob": "**/*", "input": "Layouts/", "output": "/Layouts/" } to serve root directory Layouts as root directory Layouts.

3) Include TreeGrid script (GridE.js)

Link TreeGrid script file GridE.js to the Angular main file src/index.html into <head> section as <script src="Grid/GridE.js"></script>, the path to the GridE.js file is defined in previous point 2).
Or if your Angular project displays TreeGrid only conditionally, you can link GridED.js short script instead of GridE.js main script to download the GridE.js automatically on demand.

4) Copy TreeGrid API definition (TreeGrid.TypeScript.API.d.ts)

Copy file TreeGrid.TypeScript.API.d.ts (located in the TreeGrid examples package in /ExamplesNode/ directory) to the /src directory.
This file contains TypeScript declaration of all TreeGrid API methods, properties and events.
If you use isolatedModules, import the TreeGrid.TypeScript.API.d.ts to all files where the TreeGrid API is used.

5) Copy and link TreeGrid component definition (TreeGrid.component.ts)

  • Copy file TreeGrid.component.ts (located in the TreeGrid examples package in /ExamplesNode/ directory) to the /src directory.
  • Link this file to all modules where <treegrid> tag is used.
    Import it as import { TreeGridComponent } from '../TreeGrid.component'; (optionally change the path to the file).
    And add it to the @NgModule declarations array like @NgModule({ ... declarations: [ TreeGridComponent, ...
It is required only if TreeGrid is created statically by <treegrid> tag and not dynamically by TreeGrid() function.
It is possible to modify this file e.g. to assign specific TreeGrid API events.


Create TreeGrid grid / Gantt / sheet

6) Create TreeGrid statically by HTML tag (<treegrid>)

Create TreeGrid statically somewhere in your page by adding <treegrid> tag to some html file.
Include <treegrid> tag in some <div> element that will be used as TreeGrid container (called MainTag).
For example add such code <div style="height:500px;"><treegrid Debug='check' Layout_Url="Layouts/StaticDef.js" Data_Url="Layouts/StaticData.js"></treegrid></div>.
For more information about <treegrid> tag see Creating TreeGrid.

7) Create TreeGrid dynamically by script (TreeGrid(...))

Or create TreeGrid dynamically from TypeScript by TreeGrid( ) function. For this way the point 5) is not required.
For example: var grid = TreeGrid({Debug:'check', Layout: { Url:"Layouts/StaticDef.js" }, Data: { Url:"Layouts/StaticData.js" } },"MyTag");, where MyTag is an id of <div> tag where TreeGrid will be created (it will be TreeGrid MainTag).
For more information about TreeGrid( ) function see Creating TreeGrid.

Existing grid can be deleted by grid.Dispose( ) method. For more information see Deleting TreeGrid.
To reload grid with new content use grid.ReloadBody( ) method, to recreate grid completely from new layout and data use grid.Reload( ) method. For more information see Reloading TreeGrid.
To access existing grid on page by API link the TreeGrid with Angular component in point 8) or use global Grids object as Grids[grid_id] or for the only grid on page use Grids[0], for example Grids[0].Reload();.
For more information see Accessing TreeGrid by API.

8) Link created TreeGrid with Angular component (for API)

The simplest way is to assign a reference to Angular component in TreeGrid object and assign a reference to TreeGrid object in Angular component.
  • Define some property in the Angular component that will contain a reference to the created TreeGrid.
    Name it e.g. Grid. If required, initialize it to null or undefined.
  • If TreeGrid is created statically by <treegrid> tag, do the assignment in Angular component constructor:
    export class AppComponent { ... public Grid: any; constructor(...){ ... var Component = this; Grids.OnInit = function(grid){ grid!.Component = Component; Component.Grid = grid; } ... } ...
    The Grids.OnInit can be used only if there is only one TreeGrid on page. For more grids on page assign the event only for particular grid as: ... TGSetEvent("OnInit",grid_id,function(grid){ grid.Component = Component; Component.Grid = grid; });
    In TreeGrid versions prior 14.1 use OnLoaded event instead of OnInit.
  • If TreeGrid is created dynamically by TreeGrid() function, you can do the assignment directly on TreeGrid() function call. In TreeGrid versions prior 14.1 use the previous way.
    For example: export class AppComponent { ... public Grid: any; ... this.Grid = TreeGrid({Debug:'check', Layout: { Url:"Layouts/StaticDef.js" }, Data: { Url:"Layouts/StaticData.js" } },"MyTag",{Component:this}); ... .
  • After that, the Angular component will be accessible in TreeGrid data event handlers (actions) and formulas as Grid.Component and TreeGrid will be accessible from Angular component code as this.Grid.


Create TreeGrid data (structure and content)

9) TreeGrid data formats (JSON / XML)

  • Download data format
    TreeGrid creates the grid from data in XML or JSON format. This format is proprietary for TreeGrid. The XML/JSON data contains all required definitions: configuration, columns, rows, cells, values, etc.
    You need to create this XML/JSON data and pass it to TreeGrid. How this XML/JSON data is created depends fully on you. It can be created statically in some file or dynamically by some server or client script.
    In this package there is NodeJS server with sample JavaScript code in Server/index.js that creates the JSON data for TreeGrid from SQLLite database or serves static file.
    For more information about the TreeGrid XML/JSON data format for download see Layout format and Data format. The documentation is for XML, the JSON format has the same tags, just different structure, see JSON format
  • Upload data format
    TreeGrid uploads the changes to server in XML or JSON format, similar to download format. See documentation Upload format
    TreeGrid can upload only changes (added/deleted/moved/changed rows and their cells) or the whole data (all rows or even all data), it is controlled Upload_Type.
    The server should parse this uploaded data and save it to its data source (database, file, etc.). This server side code is created you.
    In this package there is NodeJS server with sample JavaScript code in Server/index.js that parses uploaded TreeGrid JSON data and saves the changes to SQLLite database or to static file.

10) Defining TreeGrid layout (columns and configuration)

TreeGrid layout defines the grid / Gantt structure: configuration, columns (types, formats, widths, ...), toolbars, control rows, Gantt definition, etc. Simply it contains the whole TreeGrid definition except body rows and their cells. See Layout format and JSON format.
TreeGrid layout is usually static JSON or XML file located in assets (see point 2)).
But TreeGrid layout can be also dynamically created on server or by API or merged to TreeGrid data.
The layout definition is assigned in Layout object in TreeGrid() method (e.g. TreeGrid({Layout:{Url:'test.json'},...},...)) or with Layout_ prefix in <treegrid> tag (e.g. <treegrid Layout_Url='test.json' ... >).
For more information about the TreeGrid layouts see especially the Tutorial examples in this package that describe individual features and how defined and use them.

11) Creating TreeGrid data (rows and cells)

TreeGrid data defines the grid data rows and their cells with values. see Data format and JSON format.
TreeGrid data is usually created dynamically on server side from database or any other data source.
But TreeGrid data can be also static JSON / XML file or it can be generated dynamically by API.
The data definition is assigned in Data object in TreeGrid() method (e.g. TreeGrid({Data:{Url:'testdata.json'},...},...)) or with Data_ prefix in <treegrid> tag (e.g. <treegrid Data_Url='testdata.json' ... >).

12) TreeGrid data communication (AJAX / REST)

There are three usual ways of passing data to TreeGrid.
  • Built-in AJAX communication
    By default TreeGrid loads its data from server and uploads changes back to server by built-in AJAX.
    You just specify the urls where to download and upload and their parameters and TreeGrid communicates directly with server.
    For example <treegrid Layout_Url='Layouts/TableDef.js' Data_Url='http://localhost:8000/get?table=TableData&idcol=ID' Upload_Url='http://localhost:8000/set?table=TableData&idcol=ID' Upload_Format='JSON' Upload_Data='Data'>
    or TreeGrid({ Layout:{Url:'Layouts/TableDef.js'}, Data:{Url:'http://localhost:8000/get?table=TableData&idcol=ID'}, Upload:{Url:'http://localhost:8000/set?table=TableData&idcol=ID', Format:'JSON', Data:'Data'},"MyTag");
    For more information about the default AJAX communication see AJAX communication.
  • Custom communication
    For custom communication (AJAX or another type) define the TreeGrid data sources in the same way as in the previous point a.
    And define API event OnCustomAjax. In this event you get all the required information for the communication. Start the custom communication and return true. And after the communication finished call the provided callback function with the result.
    For example Grids.OnCustomAjax = function(G,IO,data,func){ MyAjax(IO.Url,data,function(result){ if(result<0) func(result,"Error"); else func(0,result); }); return true; } For more information see OnCustomAjax.
  • Direct data
    It is possible to create TreeGrid from already loaded or created data.
    Pass the data to Data parameter as string or JSON object or to Script parameter as global JavaScript variable name.
    For example you can define MyObject = { MyData: {Cols:[{Name:'A'},{Name:'B'}]} };
    and TreeGrid({Layout:{Script:"MyObject.MyData"},Data:{Data:{Body:[[{id:1,A:10,B:20},{id:2,A:20,B:40}]]}}},"MyTag");
    or <treegrid Layout_Script:"MyObject.MyData" Data_Data="{Body:[[{id:1,A:10,B:20},{id:2,A:20,B:40}]]}">
    For more information see Directly included data and Data from JavaScript.


TreeGrid events and API

13) Catch TreeGrid XML/JSON events (Actions in data)

The XML/JSON event handlers are defined in TreeGrid Defaults.xml (located in /Grid directory), in layout XML/JSON file or data or in another input XML/JSON data.
The XML/JSON events are mostly mouse and key events like OnClick or OnMouseMove. There are also a few special events like OnChange.
The handlers are defined by On... attribute in Actions tag for the whole grid or by On... attribute assigned to particular column, default column, row, default row, row cell, default row cell.
The handlers are defined as JavaScript code in string. For example Actions: { ... OnClick:"alert('Clicked cell '+Row.id+','+Col);return 1;" ... } or Body:[[{... Col1OnClick:"alert('Clicked cell '+Row.id+','+Col);return 1;" ...},...]]
The Angular component (linked in point 8)) can be accessed in the handler code by Grid.Component, for example Actions: { ... OnClick:"Grid.Component.MyProcessClick(Row,Col)" ... }
The handler should return 1 to cancel event propagation or 0 to continue propagation and run next event handlers.
For more information see TreeGrid mouse events and TreeGrid key events.

14) Catch TreeGrid API events (in script)

TreeGrid API event handlers are JavaScript callbacks, they are defined as standard JavaScript / TypeScript functions that are called from TreeGrid code when the API event happens.
The API events can be used to run some code after TreeGrid is loaded, ready or rendered or some action is started or finished like data communication, editing, sorting, filtering, mouse actions like click, etc.
The event handlers can be assigned before any TreeGrid is created, e.g. in constructor of Angular component that uses TreeGrid.
For example: export class AppComponent { ... constructor(...){ ... Grids.OnReady = function(G){ alert(G.id+" grid is ready to render"); } ... } ...
For more information about assigning API events see TreeGrid API events.

15) Using TreeGrid API (API methods)

The most of TreeGrid API methods are methods of (TGrid) grid object. The grid object can be got by this.Grid if called in the Angular component linked with created TreeGrid as described in point 8).
Or grid object can be got by global Grids object as Grids[grid_id] or for the only grid on page use Grids[0], for example Grids[0].Reload();. For more information see Accessing TreeGrid by API.
Many TreeGrid methods require (TRow) row object. The row object can be got by its id by GetRowById API method or by iterating rows, see Row iteration.
The column are passed to TreeGrid methods by their names as strings. The columns can be also iterated see Column iteration.