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

How to run FastGrid Vue examples

0) Run and test FastGrid Vue examples (optional)

Download FastGrid examples package from http://www.treegrid.com/FDownload#Trial and unzip it to some directory, preserve its directories structure.
FastGrid examples package contains simple examples for Vue framework located in /Examples/Frameworks/Vue/.
There are three examples for plain Vue without NodeJS (basic), four examples for Vue created by template (vue-create3, vue-create2, node-pwa2 and node-webpack2) and one example for Vue with TypeScript (node-typescript3). The suffix number is Vue version, the basic examples link the latest version.
The examples are for Vue versions 3 and 2. The examples for version 2 were tested and work without changes also in Vue version 1.

Plain Vue examples (without installation and NodeJS)

  • Copy the whole FastGrid package to your web server to be accessible by browser.
    Especially the /Grid/ and /Examples/Frameworks/Vue/basic/. Preserve the directory structure when copying.
  • Run the /Examples/Frameworks/Vue/basic/Static.html page from your http server url in your browser. This example creates FastGrid statically by <fast-grid> tag.
  • Or run the /Examples/Frameworks/Vue/basic/StaticAsVueComponent.html page from your http server url in your browser. This example creates FastGrid statically by custom Vue tag <fastgrid>.
  • Or run the /Examples/Frameworks/Vue/basic/Dynamic.html page from your http server url in your browser. This example creates FastGrid dynamically by JavaScript FastGrid() function.

Vue examples created by vue create (Vue 2 and 3) or by vue-create with TypeScript (Vue 3) or by NodeJS template pwa (Vue 2) or webpack (Vue 2)

  • Go to directory /Examples/Frameworks/Vue/vue-create2/ or .../vue-create3/ or .../vue-create-typescript3/ or .../node-pwa2/ or .../node-webpack2/
  • 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:8080/ to run the examples.

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

The server is needed for the most of the Vue examples to serve their data.
  • Go to directory /Examples/Frameworks/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 FastGrid in Vue project



Installation

1) Copy FastGrid script (/Grid/FGridE.js)

Copy FastGrid script file(s) from FastGrid examples package to the Vue project. The FastGrid examples package can be downloaded from http://www.treegrid.com/FDownload#Trial
  • Copy the FastGrid script file /Grid/FGridE.js from FastGrid package to your Vue project.
    The destination location can be chosen freely, it just must be accessible for the server for reading.
    In some types of Vue it must be copied into specific directory, e.g. in vue-create template it must be copied to /public directory or some its subdirectory and in pwa or webpack template it must be copied into /static directory or some its subdirectory!
    It can be also shared among more Vue projects if the location is accessible for all the project servers.
  • Optionally if you purchased the partial sources, copy the FastGrid script file that loads partial sources /Grid/FGridEPart.js and also copy the whole /GridSrc directory, from FastGrid package to your Vue project.
    If you plan to modify FastGrid defaults, texts, language and styles files and want to link the modified source files to FastGrid for simpler debugging.
  • Optionally if you purchased the debug sources, copy the FastGrid script file that loads debug sources /Grid/FGridESrc.js and also copy the whole /JS and /GridSrc directories, from FastGrid package to your Vue project.
    Remember, the FastGrid source files must not be accessible outside your company!.

2) Include FastGrid script (FGridE.js)

Link FastGrid script file FGridE.js to the Vue main html file, e.g. into index.html, into <head> section as <script src="FGridE.js"></script>, use correct path to FGridE.js file.
Or if your Vue project displays FastGrid only conditionally, you can link FGridED.js short script instead of FGridE.js main script to download the FGridE.js automatically on demand.

3) If you use TypeScript copy FastGrid TypeScript API definition (FastGrid.TypeScript.API.d.ts)

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


Create FastGrid grid / sheet

4) Create FastGrid statically by HTML tag (<fast-grid>)

Create FastGrid statically somewhere in your page by adding <fast-grid> tag to some html file or in Vue component template.
  • Include <fast-grid> tag in some <div> element that will be used as FastGrid container (called main tag). It can be included directly in html code in page or in html code in Vue component template.
    Add the v-pre attribute to the <fast-grid> tag to avoid Vue warning about custom tag.
    For example add such code <div style="height:500px;"><fast-grid v-pre src="['static/Layouts/StaticDef.js','static/Layouts/StaticData.js']"></fast-grid></div>.
  • If the html code with <fast-grid> tag cannot not be rendered on page start, add defef="0" attribute to the <fast-grid> and call FGrid.StartFastGrid() function to process the created <fast-grid> tags.
    The StartFastGrid() must be called after the html code with the tags is rendered to the page, for example mounted: function () { StartFastGrid(); } The StartFastGrid() can be called more times without any problem, it processes every tag only once.
  • Or as the second option, create custom Vue tag, called e.g. <fastgrid> and use it instead of <fast-grid> and without v-pre attribute.
    Define: Vue.component('fastgrid', { props: { src: { type:String, required:true } }, template: "<div></div>", mounted: function(){ FGrid.FastGrid(this.src,this.$el); } });
    Use: <div style="height:500px;"><fastgrid src="['static/Layouts/StaticDef.js','static/Layouts/StaticData.js']"></fastgrid></div>.
For more information about <fast-grid> tag see Create FastGrid.

5) Create FastGrid dynamically by script (FastGrid(...))

Or create FastGrid dynamically from JavaScript or TypeScript by FGrid.FastGrid( ) function.
For example: var grid = FGrid.FastGrid(["Layouts/StaticDef.js","Layouts/StaticData.js"],"MyTag");, where MyTag is an id of <div> tag where FastGrid will be created (it will be FastGrid main tag).
For more information about FastGrid( ) function see Create FastGrid.

Existing grid can be deleted by grid.Dispose( ) method. For more information see Dispose().
To reload grid with new content use grid.Reload( ) method. For more information see Reload().
To access existing grid on page by API link the FastGrid with Vue component in point 6) or use FGrid.Grids object as FGrid.Grids[grid_id] or for the only grid on page use FGrid.Grids[0], for example FGrid.Grids[0].Reload();.
For more information see Access grid by API.

If FGrid is reported as error not defined (no-undef), access it as window.FGrid or declare it in global scope as var FGrid;

6) Link created FastGrid with Vue component (for API)

The simplest way is to assign a reference to the Vue component in FastGrid object and assign a reference to FastGrid object in the Vue component.
  • Define some property in Vue component that will contain a reference to the created FastGrid.
    Name it e.g. Grid. If required, initialize it to null or undefined.
  • If FastGrid is created statically by <fast-grid> tag or contains more sheets,do the assignment in Vue component created event:
    export default defineComponent({ ... data: function() { return { Grid: null } }, ... created: function () { FGrid.OnTag = (grid) => { grid.Component = this; this.Grid = grid; } ... In TypeScript do similarly:
    export default defineComponent({ ... data: function() { return { Grid: null as never as TGrid } }, ... created: function () { FGrid.OnTag = (grid : TGrid) => { grid.Component = this; this.Grid = grid; } ... If the FastGrid is a book with more sheets, the OnTag assigns the actually displayed sheet and updates it whenever is displayed different sheet.
  • If FastGrid is created dynamically by FGrid.FastGrid() function, you can do the assignment directly on FastGrid() function call. But still can be used the assignment in OnTag.
    For example: mounted: function(){ this.Grid = FGrid.FastGrid(["Layouts/StaticDef.js","Layouts/StaticData.js"], "MyTag");.
  • After that, the FastGrid will be accessible from the Vue component as this.Grid and the Vue component will be accessible from the FastGrid event handlers, formulas and actions as Grid.Component.


Create FastGrid data (structure and content)

7) FastGrid data format (JSON)

  • Download data format
    FastGrid creates the grid from data in JSON format. This format is proprietary for FastGrid. The JSON data contains all required definitions: configuration, columns, rows, cells, values, etc.
    You need to create this JSON data and pass it to FastGrid. How this JSON data is created depends fully on you. It can be created statically in some file or dynamically by some server or client script.
    Or the data can be also in XLSX or CSV format.
    In this package there is NodeJS server with sample JavaScript code in Server/index.js that creates the JSON data for FastGrid from SQLLite database or serves static file.
    For more information about the FastGrid JSON data format for download see Layout format and Data format.
  • Upload data format
    FastGrid uploads the changes to server in JSON format, similar to download format. See documentation Upload format
    FastGrid 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 SaveFlags.
    The server should parse this uploaded data and save it to its data source (database, file, etc.). This server side code is created by you.
    In this package there is NodeJS server with sample JavaScript code in Server/index.js that parses uploaded FastGrid JSON data and saves the changes to SQLLite database or to static file.

8) Defining FastGrid layout (columns and configuration)

FastGrid layout defines the grid structure: configuration, columns (types, formats, widths, ...), toolbars, control rows, Gantt definition, etc. Simply it contains the whole FastGrid definition except body rows and their cells. See Layout format.
FastGrid layout is usually static JSON file, usually located in /public or similar directory accessible directly for browser.
But FastGrid layout can be also dynamically created on server or by API or merged to FastGrid data. The layout definition is usually passed in the FastGrid / <fast-grid> src array before data, but it is not required.
For more information about the FastGrid layouts see especially the Tutorial examples in this package that describe individual features and how defined and use them.

9) Creating FastGrid data (rows and cells)

FastGrid data defines the grid data rows and their cells with values. see Data format.
FastGrid data is usually created dynamically on server side from database or any other data source.
But FastGrid data can be also static JSON, XLSX or CSV file or it can be generated dynamically by API.
The data definition is usually passed in the FastGrid / <fast-grid> src array after layout, but it is not required.

10) FastGrid data communication (AJAX / REST)

There are three usual ways of passing data to FastGrid.
  • Built-in AJAX communication
    By default FastGrid 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 FastGrid communicates directly with server.
    For example
    or FastGrid(['Def.js',{Cfg:{SaveUrl:'Basic.js?func=set',PdfUrl:'../Pdf.js?func=getpdf'}},'Basic.js?func=get'],"MyTag");
    For more information about the default AJAX communication see Create FastGrid.
  • Custom communication
    For custom communication (AJAX or another type) define the FastGrid data sources in the same way as in the previous point a.
    And define API event OnDataSend. 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.OnDataSend = function(G,source,func,index){ MyAjax(source.Url,source.Param.Data,function(result){ if(result<0) func("Error",result); else func(result); }); return true; } For more information see OnDataSend.
  • Direct data
    It is possible to create FastGrid from already loaded or created data.
    Pass the data directly as datasource string or JSON object or to Code parameter as JavaScript code run in global scope.
    For example you can define MyObject = { MyData: {Cols:[{id:'A'},{id:'B'}]} };
    and FastGrid([{Code:"MyObject.MyData"},{Body:[{id:1,V:{A:10,B:20}},{id:2,V:{A:20,B:40}}]}],"MyTag");
    or <fast-grid src:"[{Code:'MyObject.MyData'},{Body:[{id:1,V:{A:10,B:20}},{id:2,V:{A:20,B:40}}]}]">
    For more information see Code attribute.


FastGrid events and API

11) Catch FastGrid action events (Actions in data)

The default action event handlers are defined in FastGrid Defaults.js (located in /GridSrc directory) and they can be (re)defined in input JSON data.
The action events are mostly mouse and key events like OnClick or OnDel. 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 row, column, cell, toolbar and toolbar cell.
The handlers are defined as JavaScript code in string. For example Actions: { ... OnClick:"alert('Clicked cell '+Row.id+','+Col.id);return 1;" ... } or Body:[{... A:{... Col1:{... OnClick:"alert('Clicked cell '+Row.id+','+Col.id);return 1;" ...} ...} ...},...]]
The Vue component (linked in point 6)) 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 FastGrid mouse events and FastGrid key events.

12) Catch FastGrid API events (in script)

FastGrid API event handlers are JavaScript callbacks, they are defined as standard JavaScript / TypeScript functions that are called from FastGrid code when the API event happens.
The API events can be used to run some code after FastGrid 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 FastGrid is created, in input JSON data (Events tag) or e.g. in constructor of Vue component that uses FastGrid.
For example: created: function () { ... FGrid.OnReady = function(G){ alert(G.id+" grid is ready to render"); } ...
For more information about assigning API events see FastGrid API events.

13) Using FastGrid API (API methods)

The most of FastGrid API methods are methods of (TGrid) grid object. The grid object can be got by this.Grid if called in the Vue component linked with created FastGrid as described in point 6).
Or grid object can be got by global FGrid.Grids object as FGrid.Grids[grid_id] or for the only grid on page use FGrid.Grids[0], for example FGrid.Grids[0].Reload();. For more information see Accessing FastGrid by API.
Many FastGrid methods require (TRow) row, (TCol) col, (TToolbar) toolbar objects. These objects can be got by its id from grid.Rows[id] / grid.Cols[id] / grid.Toolbars[id]. Rows and columns can be also iterated using grid.Iter...() functions, see Iter.