Input / output data
FastGrid documentation
Simple examples of creating FastGrid
Basics
The simplest page with FastGrid:
<html>
<
head>
<script src="FGridE.js"> </script> <!-- including FastGrid script -->
</
head>
<
body>
<fast-grid style="height:300px;"
src="[{ Cols:[ {id:'C1',Width:100}, {id:'C2',Width:150} ], Head:[{D:'Header'}], Body:[ {V:{C1:'V1',C2:'V2'}}, {V:{C1:'V3',C2:'V4'}} ] }]">
<!-- FastGrid main tag and data source definition -->
</
body>
</html>
Creating by API
FastGrid is created after click to button Create:
<html>
<
head>
<script src="FGridE.js"> </script> <!-- including FastGrid script -->
</
head>
<
body>
<
div id="Main"
style="height:300px;"> </
div>
<!-- FastGrid main tag with id -->
<
button onclick='Create()'>Create</
button>
<
script>
function Create(){
// Creates FastGrid dynamically from JSON object in 'Main' tag
FGrid.FastGrid( [{ Cols:[ {id:'C1',Width:100}, {id:'C2',Width:150} ], Head:[{D:'Header'}], Body:[ {V:{C1:'V1',C2:'V2'}}, {V:{C1:'V3',C2:'V4'}} ] }], "Main" );
}
</
script>
</
body>
</html>
Version upgrade
When you are upgrading to new version or registered license or newly compiled script you can add some version info as query string to FGridE.js to ensure using the new one and suppress caching the old one, for example:
<script src="../Grid/FGridE.js?Version=2.0.12"> </script>
Create FastGrid
FGrid function Grid
FastGrid
(any src, any tag = null, function onfinish = null)
Creates new FastGrid, returns its object and starts its loading and rendering.
src contains json data or urls returning json data to load grid from.
src can be:
1) | string |
as direct url or json data in string
For example: FGrid.FastGrid("../MyData/Data.json","tag")
or: FGrid.FastGrid("{Cols:['A','B','C'],Body:[{id:1,V:[1,2,3]},{id:2,V:[3,4,1]}]}","tag")
|
2) | object without Sources, Url and Data attributes |
as direct json data or ByteArray data as xlsx content
For example: FGrid.FastGrid({Cols:['A','B','C'],Body:[{id:1,V:[1,2,3]},{id:2,V:[3,4,1]}]},"tag")
|
3) | object with Url or Data attribute |
as Source object
For example: FGrid.FastGrid({Url:"../MyData/Data.json",Param:{P1:1,P2:"test"}},"tag")
|
4) | array of items 1), 2), 3) |
as array of string urls or json data strings or json objects or Source objects
For example: FGrid.FastGrid(["../MyData/Layout.json",{Cols:['A','B','C'],Body:[{id:1,V:[1,2,3]},{id:2,V:[3,4,1]}]},{Url:"../MyData/Data.json",Param:{P1:1,P2:"test"}}],"tag")
|
5) | object with Sources attribute |
as Sources complex object with settings like Progress. Sources is array of items to load as array of string urls or json data strings or json objects or Source objects
For example: FGrid.FastGrid({Sources:["../MyData/Layout.json",{Cols:['A','B','C'],Body:[{id:1,V:[1,2,3]},{id:2,V:[3,4,1]}]},{Url:"../MyData/Data.json",Param:{P1:1,P2:"test"}}], Progress:100000},"tag")
|
tag specifies where FastGrid will be rendered.
tag can be:
1) | string | as id of HTML element where the FastGrid will be rendered into its innerHTML. It will be set as main Tag. |
2) | HTMLElement object | as HTML element where the FastGrid will be rendered into its innerHTML. It will be set as main Tag. |
3) | Array | as Place Area to show FastGrid for this area as popup dialog. |
4) | Object | as standard FastGrid Sources / Source object like src types 2), 3) and 5). It is added to the end of src. |
If set neither
tag as HTMLElement / id nor
Place Area /
Tag,
FastGrid is not rendered at all and to show it must be rendered by
Render function.
If the
tag is not set as HTMLElement / id, FastGrid cannot display informational messages during loading.
If set
onfinish, the function is called after the grid is rendered as
onfinish(
Grid,
Tag) or loaded (if not set
tag, as
onfinish(
Grid)).
The tag should have set fixed CSS height in pixels to permit vertical scroll! Or if it should have resize to its parent tag fixed height, it should have set percentage height. See Grid size.
FGrid function void
StartFastGrid
( )
Processed all <fast-grid> tags that were deferred by
defer attribute.
HTML HTMLElement
<fast-grid>
Custom HTML element that places FastGrid to the HTML page. It can be used instead of
FGrid.FastGrid() to create FastGrid.
It should have set
src attribute to load the data from.
<fast-grid> is standard HTML block tag and can have HTML attributes like
id,
class or
style.
This tag will be set to the
Tag attribute of the created FastGrid.
For example:
<fast-grid src="['Def.js','Data.js']" style="border:1px solid red;height:500px;"/>
The <fast-grid> tag should have set fixed CSS height in pixels to permit vertical scroll! Or if it should have resize to its parent tag fixed height, it should have set percentage height. See Grid size.
<fast-grid> string
src
Contains json data or urls returning json data to load grid from. It is the same as
FastGrid src parameter.
It is string, but can be set to JavaScript
Source object or array in the string, starting by "[" or "{".
Examples:
src="Data.js",
src="['Def.js','Data.js']",
src="[{Url:'Def.js',Method:'Get'},'Data.js']",
src="{Source:['Def.js','Data.js]}"
<fast-grid> int
defer
If set to
0, does not process the tag automatically. To process it, call
StartFastGrid.
If set to
1, processes the tag after document is fully loaded, in window onload.
If set to >=
2, defers the tag processing by given number of milliseconds after the document is fully loaded.
Attribute defer > 0 calls StartFastGrid (in timeout or on window onload) that processes all <fast-grid> tags on page regardless on their defer attribute.
<fast-grid> string
onfinish
DOM event handler called after the grid is loaded and rendered. It is JavaScript code run after grid render. The same as
FastGrid onfinish parameter.
The JavaScript code can use two variables,
Grid as the created grid and
Tag the <fast-grid> where the grid is placed.
For example
<fast-grid src="Data.js" onfinish="console.log('Created grid '+Grid.id)"/>.
Source string
Url
Server url returning json data for FastGrid.
It can be any standard full or relative URI, on http://, https://, file://, data:, etc.
Source any
Data
Direct data to load to grid instead of downloading them from
Url.
The data can be:
a)
string as json data in string or csv if set
Format="csv".
b)
object as json object or xlsx if the object is ByteArray.
Source string
Code
JavaScript code in string that returns the direct data. It is run in global scope. If it does not contain "return" statement, it is added on its beginning.
It is usually used in
<fast-grid/>, for example
<fast-grid src="[{Code:'MyGlobalObject.MyDef'},{Code:'MyGlobalObject.MyData'}]"/>.
The returned data can be:
a)
string as json data in string or csv if set
Format="csv".
b)
object as json object or xlsx if the object is ByteArray.
Source string
Format
Data format, case insensitive.
It can be set to
json,
xlsx,
csv.
In input data it should be specified if it cannot be found out from the data or url.
The
xlsx is chosen if the
Url ends by ".xlsx" or the source contains direct data in ByteArray.
The
csv is chosen if the
Url ends by ".csv".
The
json is chosen in all other cases.
Source string
Method
Method used for communication with
Url, case insensitive:
null / "" - direct download using html <script> tag. With parameters in url.
get - AJAX using http GET method with parameters in http url.
post /
form - AJAX using http POST method with parameters in http request.
The get / post / form is ignored and null is used if Url uses file:// protocol.
Source string / bool
Add
[0/1]
If set to anything except
0 or
null, adds this attribute name with random value to the
Url. To avoid caching the url by browser.
It can be set to
1 to add parameter named
fgc.
By default it is set to
0 for
post /
form Method and to
1 for other methods.
Source string[id]
Param
Parameters sent with the request, set as name:value.
For
Method = null / "" / "get" includes the parameters in
Url with
?.
For
Method = "post" / "form" includes the parameters in the http body request.
For example
{ Param: { Par1:"val1", Par2:"val2" } }
Source string[id]
Header
HTTP header parameters sent with the AJAX request, set as name:value. Used only if set
Method.
Source bool
Sync
[0]
If set, uses synchronous AJAX communication. Used only if set
Method.
Source string
User
Optional user name set in the AJAX request. Used only if set
Method.
Source string
Pass
Optional password set in the AJAX request. Used only if set
Method.
Source int
Safe
[0]
0 - uses JavaScript eval for parsing the input data. The format is less strict, but if the data contains JavaScript code, it is executed.
1 - uses JavaScript eval for parsing the input data, but fails if the json contains any functions calls, global assignments or function definitions. The format is still less strict than JSON parse. It also switches
Method from null to get.
2 - uses safe JSON.parse for parsing the input data. It requires correct JSON format, but never runs any JavaScript code in data. It also switches
Method from null to get.
Source bool
Encode
[0]
If set, encodes the
< as
< and
& as
& in all
Param values.
Use to avoid the ASP.NET validation especially in save requests.
Source string / object
Error
If set and the communication fails, the Error is used as the response and the communication error is ignored.
Source int / object
Defer
If set to
1 or object, it does not load this source on grid loading, but loads it on background after grid is created and rendered. It uses
LoadData method.
It can be set to object to display progress text in given FastGrid cell, with attributes:
string Row,
string Col (ids of cell or toolbar cell where to display the progress text),
int Max (expected bytes to download),
string Text = "$LoadingDataProgress", the text displayed in the cell.
Use to load large data on background, while grid first loads first small part of data and the rest is loaded on background while grid is fully usable.
After all the
Defer are loaded, the
OnLoadedData is called.
If set to
2 it loads the source on grid loading, but adds it later after grid partial initialization and loading cookies, just before sorting, grouping and filtering.
Sources any
Sources
Array of data to load to the grid. Items content can be as point 1) or 2) or 3) in
FastGrid()
src attribute.
For example:
FGrid.FastGrid( { Sources: ["Def/Data2Def.js", { Url: "Data/Data2.js", Method:"Get" } ] }, tag)
Sources int
Progress
[0]
If set, it shows progress message during loading. It can be set only to the main object passed to the
FastGrid, not to individual source items.
If set to >1, it is count of bytes to download, if the data source does not return its size.
It is applied only for AJAX communication -
Method must be set for the data sources and the page must not run on file:// protocol.
For example:
FGrid.FastGrid( { Sources: ["Def/Data2Def.js", { Url: "Data/Data2.js", Method:"Get" } ], Progress:156000000 }, tag)
Sources object
D
Default parameters added to all
Source objects for AJAX communication in
Sources.
For example:
FGrid.FastGrid( { D: { Method:"Get", Safe:0 }, Sources: [ "Def.js", { Url:"Data/Data.js", Safe:1 } ] }, tag)
Grid method Sources
GetSources
(bits flags = 0)
Returns the original sources the grid was created from, the
src parameter of the
<fast-grid> or
FastGrid().
If set
flags&
1, returns
Sources property instead of the full
src, if the
src contained it.
API event object / string
OnDataSend
(Grid grid, Source source, function func, int index)
Called before starting communication with given
source. It is called for any source, including static data.
Use for
custom communication or to modify the data source parameters.
index is the index of the
source in the loaded
Sources.
Return null to continue without changes.
Or return {} to ignore this data
source.
Or return new or modified
source to load it instead.
Or return true for custom communication. In this case call function
func(
object / string data) with the loaded data or call
func(
string message,
int error) in case of error.
API event object / string
OnDataGet
(Grid grid, Source source, object / string data, int index)
Called after successfully received and parsed data from given
source. It is called for any source, including static data.
index is the index of the
source in the loaded
Sources.
The
data is the parsed response. For JSON it is JavaScript object, for CSV it is string, for XLSX it is unzipped xlsx data.
Return new
data to modify the response from server. The returned data can be JSON object or string, CSV string, raw XLSX byteArray or unzipped XLSX.
API event object
OnLoadError
(Grid grid, Source source, int code, string message, int index)
Called when loading any part of the data failed.
index is the index of the
source in the loaded
Sources.
Returning null or false will continue with fatal error.
Returning true will continue with ignoring this data source.
Returning JSON object will continue with it as a response from the errorneous data source.
source is the data source being loaded.
code is http error code
<200 or
>=300 in AJAX communication or negative as internal error code:
-1 - Communication aborted (AJAX)
-2 - Internal communication error (AJAX)
-3 - Timeout expired (AJAX)
-4 - Empty response (AJAX)
-5 - Invalid JSON data (script)
-6 - Not found (script)
-7 - Xlsx loaded on file protocol (xlsx)
-8 - Invalid xlsx data (xlsx)
-9 - Invalid csv data (csv)
-10 - Error loading imported file (import)
-11 - Unsupported file format (import)
-12 - Incorrect
Code code or its execution failed (script)
API event object
OnDataError
(Grid grid, object data)
Called when the JSON
data being added to grid contains
IO Result <
0.
Returning null or false will continue normally and will add the
data to grid.
Returning true will continue with ignoring this
data.
Returning JSON object will add it to grid instead of
data.
API event object
OnAddData
(Grid grid, object data)
Called before the JSON
data are added to grid.
It is not called for source JSON files like Defaults.js or Texts.js.
Returning null or false will continue normally and will add the
data to grid.
Returning true will continue with ignoring this
data.
Returning JSON object will add it to grid instead of
data.
API event object
OnLoad
(Grid grid, int counter)
Called after all data to grid were loaded, but not updated / initialized yet. It is called directly before
OnLoaded.
It can return new
Sources /
Source object / string / array, the same as
src parameter in
FastGridgrid data to load the sources.
If it returns something, it loads it and is called again with increased
counter by 1. In the first call is the
counter = 0.
It is called again and again while it does not return null!
API event object
OnLoaded
(Grid grid)
Called after all data to grid were loaded, but not updated / initialized yet. It is called directly after all
OnLoad calls.
It can return new grid data to add to the grid like by call
AddData.
It is often defined by FastGrid components like Menu or Calendar! In this case define the OnInit instead.
API event object
OnInit
(Grid grid)
Called after all data to grid were loaded, but not updated / initialized yet. It is called directly after
OnLoaded.
It can return new grid data to add to the grid like by calling
AddData.
API event void
OnInitialized
(Grid grid)
Called after all data to grid were loaded and initialized, but the grid was not updated and rendered yet.
API event void
OnUpdated
(Grid grid)
Called after all data to grid were loaded, initialized and updated (sorted, grouped, filtered ...), but the grid was not rendered yet.
API event HTMLElement
OnTag
(Grid grid, HTMLElement tag)
Called before the grid is rendered to the new tag or new grid is rendered to the same tag.
It is called for new rendered grid or when switched to new sheet in a Book or when imported new book to the grid. It is
not called for grid dialog.
The
tag is the DOM tag where the grid will be rendered to. It can be different than actual
grid.Tag.
The handler can return another HTMLElement to render the grid to. The returned tag must be already in the DOM.
Called directly before
OnRender, but not every OnRender.
It can be used to assign the grid object to some framework component, to contain always the displayed grid / sheet.
API event void
OnRender
(Grid grid, int type)
Called when starts rendering the grid. Called before every render (on
Render, but
not on every
Paint).
type =
0 - called on every next re-render.
1 - called of the first render of normal grid.
2 - called on the first render of popup grid dialog.
API event void
OnReady
(Grid grid, bool first)
Called after the grid was fully rendered and is ready to use. Called after every render (on
Render, but
not on every
Paint),
first is set on the first render.
API event void
OnReadyAnimate
(Grid grid)
Called after animation of showing the grid as dialog finished and the grid receives events.
Grid method int
IsBusy
( )
Returns ready state of the grid:
-2 - grid is disposed and cannot be used,
-1 grid was loaded with error and shows fatal error.
0 - grid is ready.
1 - grid is loading on start,
2 - grid is updating loaded data on start,
3 - grid is sorting, filtering, grouping,... on start,
4 - grid is rendering on start.
6 - grid is loading data on background by
LoadData,
7 - grid is updating data loaded on background.
8 - grid is processing mouse or key event.
10 - grid is disabled or shows modal dialog or message,
11 - grid is not rendered (hidden).
Grid method void
AddData
(object data, bits options = 0)
Adds given
data to the grid.
data is full grid definition as standard response from FastGrid data source. It can be JSON object or JSON in string.
data can be also array of JSON objects or JSON strings to add all at once, especially if adding to initialized grid.
For example:
grid.AddData({DefRows:{Test:{TextColor:"red"}},Body:[{id:17,D:"Test",V:[1,2,3,4]}]});
If set
options&
1, adds the data to grid
Sources to be added also after reload.
If set
options&
2, accepts all changes set by the data: all row and column
O attributes are processed, items with
O&
4 are removed, items with
O&
512 are selected / unselected and the
O attribute is cleared in all items.
If set
options&
4, sorts, groups, filter and searches again the affected parts.
If set
options&
32, does not add any not existing rows or columns (like all them have
Add=0).
AddData can be called during grid loading (the
options&
2+
4 are ignored) or when grid is fully loaded.
Returns true if data was successfully added, otherwise returns false.
Grid method void
LoadData
(any src, function onfinish = null, any progress = null)
Loads data asynchronously to already fully loaded grid.
src is the data sources, the same as in
FastGrid.
If set
onfinish, the function is called after the data are loaded and added to grid, directly before
Paint, as
onfinish(
Grid,
result). The
result is
0 for success and
-1 for error.
progress can be function called during loading as
progress(
source,
loaded,
total,
real),
where
source is the loaded
Sources,
loaded is reported loaded bytes count,
total is total bytes to load from data source (
it is often 0 as uknown!) and
real is loaded characters count.
progress can be object to display progress text in given FastGrid cell, with attributes:
string Row,
string Col (ids of cell or toolbar cell where to display the progress text),
int Max (expected bytes to download),
string Text = "$LoadingDataProgress", the text displayed in the cell.
API event bool
OnLoadData
(Grid grid, any src, function onfinish)
Called when grid starts loading of
Defer data source or source loaded by
LoadData.
Return true to cancel loading. In this case the
onfinish is not called and can be called by the event handler.
src and
onfinish are parameters of
LoadData.
API event void
OnLoadedData
(Grid grid)
Called after grid finished loading of
Defer data source or source loaded by
LoadData. It is called before Paint.
Grid method void
Dispose
(bool book = 0)
Clears the grid and frees all its resources.
It is called in setTimeout when called from FastGrid event handler of the reloaded grid or its dialog.
For
book =
1 disposes all grids in the grid's
Book.
FGrid function void
DisposeGrids
( )
Disposes all grids on page.
It is called in setTimeout when called from FastGrid event handler of the reloaded grid or its dialog.
Grid method void
Reload
(any src, bits type = 0, function onfinish = null, bool transparent = 0)
Reloads the grid.
If the grid is in
Book, it reloads the whole book.
If not set
src, reloads grid from the same sources.
If set
src and
type&
1 =
0, reloads the grid with
src data.
If set
src and
type&
1 =
1, reloads the grid with the same data and next loads also
src data. The
src data are
not added to original source data for next
Reload.
If set
type&
2, does not preserve the grid
id.
If set
transparent, shows the disabled qrid semi transparent during reloading.
Other parameters are the same as in the
FastGrid function.
It is called in setTimeout when called from FastGrid event handler of the reloaded grid or its dialog.
FGrid function any
AjaxCall
(any src, string data, function onfinish = null)
Universal function to do synchronous or asynchronous AJAX call to send data to and / or receive data from server.
src is server URL to communicate with. It can be absolute or relative, or even static local file.
src can be also JavaScript object as the
FastGrid data source.
data is the data to send to server in parameter named
Data.
If the
onfinish is not set, the function does synchronous AJAX call and returns the received response. For error returns null.
If the
onfinish is set, the function does asynchronous AJAX call and after finish it calls
onfinish: function (response,error,src).
If the
src contained more urls to load, the
onfinish response and
error or the function return are array of the restuls.
Actions
Reload
(int target = 0, bits flags = 0)
OnClickReload
Reloads the grid from the same sources.
If the grid is in
Book, it reloads the whole book.
If set
flags&
1, reloads the grid without confirmation message.
If set
flags&
2, reloads the grid without preserving actual configuration.
If set
flags&
4, reloads all grids with the same
UndoId, if the grid has set UndoId and not set Book.
IO int
Result
[0]
It can be filled in the JSON data in IO tag. If set,
OnDataError is called for this data.
IO string
Message
Message shown in grid after load as
MessageD or as
Ok message for
Result>=0 or
Error message for
Result<0.
IO string
MessageD
Message default for IO
Message.
Display grid
Grid variable object
Tag
FastGrid main tag - HTML tag where the grid is rendered into. It is set also if the grid is rendered as dialog.
Grid method bool
Render
(any tag)
Renders grid into given HTML
tag. Sets the
tag as the grid main
Tag.
If the grid was rendered into another tag, clears the previous tag content and renders grid into the new
tag.
tag can be the HTML tag object or its id as string.
The
tag can be set also to JavaScript object as
Place object with attribute
Area to render the grid as a dialog.
For example
grid.Render({Area:[100,200]}); will render the grid on position 100,200 on page.
Grid method bool
HideGrid
(bool clearhtml = 0, int closedialog = 0)
Hides the grid. If the grid is shown as dialog, hides the whole dialog. Otherwise it hides content of the main
Tag.
For
clearhtml =
0 it sets display:none to the grid content tag. For
clearhtml =
1 it clear the whole html from the main
Tag.
If set
closedialog it closes the grid
Dialog and finishes editing, if any. For
closedialog =
2 it forces closing the dialog and finishing editing.
Returns true for success. Returns false if the grid is already hidden or dialog cannot be closed or editing cannot be finished.
Grid method bool
ShowGrid
( )
Shows grid hidden by
HideGrid. Returns true for success. Returns false if the grid is not hidden or cannot be shown (has not set
Tag).
API event bool
OnHideGrid
(Grid grid, bool clearhtml, bool force)
Called before the grid is hidden, e.g. on sheet switch. Return true to suppress the hiding.
For
clearhtml =
0 it sets display:none to the grid content tag. For
clearhtml =
1 it clear the whole html from the main
Tag.
For
force =
1 it will ignore the return value and will hide the grid always.
API event void
OnHidGrid
(Grid grid, bool clearhtml)
Called after the grid was hidden.
For
clearhtml =
0 it sets display:none to the grid content tag. For
clearhtml =
1 it clear the whole html from the main
Tag.
API event bool
OnShowGrid
(Grid grid, bool clearhtml)
Called before the grid is shown by
ShowGrid, e.g. on sheet switch. It is not called on render. Return true to suppress the showing.
For
clearhtml =
0 it sets display:none to the grid content tag. For
clearhtml =
1 it clear the whole html from the main
Tag.
API event void
OnShowedGrid
(Grid grid)
Called after the grid was shown. It is not called on render.
Access grid by API
Unique grid identification.
It must not be number. By the
id the grid can be accessible in global
FGrid.Grids array, as
FGrid.Grids[id].
The
id cannot be changed. If defined more times in input data, the first definition is used and the others are ignored.
If created grid with already existing id, the old grid is disposed.
If not defined the
id attribute, it is generated as
Grid +
Index, the index can be assigned higher if the grid already exists.
If not defined the
id attribute in
Book, it is generated as
Text.$DefaultSheet with replaced the first number by the
Index, the index can be assigned higher if the grid already exists.
Grid int
Index
Unique generated grid number index. By the index the grid can be accessible in global
FGrid.Grids array, as
FGrid.Grids[index].
FGrid variable Grid[]
Grids
Contains all defined grids on page. Every grid is included twice or three time, once by its
id, once by its
Index and optionally once by
id in lower case.
To iterate all grids on page use loop
for(var i=0;i<FGrid.Grids.length;i++) if(FGrid.Grids[i]){ ... }.
In some environments like React it is required to access the global variables as window properties: window.FGrid.Grids.
global variable object
FGrid
Global object with all FastGrid global setting. It contains especially defined
API event handlers and array of all grids in
Grids.
It is the only global JavaScript object FastGrid defines and uses.
In some environments like React it is required to access the global variables as window properties: window.FGrid.
Sheets - more grids switched in one place
It is possible to load more grids at once and display one of them in the destination
Tag and switch the display using toolbar "Sheets".
To load more sheets at once, specify different
Sheet per loaded data source - it will create more grids.
Or specify
Sheets attribute to load more sheets from one data source.
Or specify
xlsx file as data source.
Global dialog to manage sheets can be shown by
Grid.ShowDialog(null,null,'Sheets').
Source string
Sheet
[null / "*"]
Sheet id the
Source is loaded to.
If the grid has not set its
id yet, the
Sheet is set to the grid
id and the data source is loaded into this grid.
If the grid has the same
id as the
Sheet, the source is loaded into this grid.
If the grid has different
id than the
Sheet, the source is loaded into the other grid with given
Sheet id. If such grid does not exist yet, it is created first.
It can be set to comma separated string or array of strings of sheet ids to load the data source to more sheets.
It can be set to "
+" to load the data source to hidden sheet that will be used as source for newly added sheets by
AddSheet toolbar button.
It can be set to "
*" to load the data source to every sheet loaded in this data source, including the new sheet.
For example
FGrid.FastGrid([ { Sheets: [ "Sheet2", { Sheet:"Sheet1", Cfg: { Active:1 } } ] }, { Sheet:"Sheet1,+", Url: "../Def/Data1Def.js"},
{ Sheet:"Sheet1", Url:"../Data/Data1x1000.js" }, { Sheet:"Sheet2", Url:"../Def/Data2Def.js" }, { Sheet:"Sheet2", Url:"../Data/Data2x1000.js" } ],"maintag");
If any of input data has
Format = "xlsx", default value of the Sheet in all other input data sources is "
*" to apply them to all sheets; otherwise the Sheet is null.
Grid string
Sheet
The Sheet can be set also in the root attribute in the JSON data, its meaning is the same as Source
Sheet. If set both, the Source Sheet is preferred.
Cfg string
Sheet
The Sheet can be set also in the Cfg attribute in the JSON data, its meaning is the same as Source
Sheet. If set both, the Source Sheet is preferred.
It can be placed only to Cfg tag without any sufffix _xxx!
Grid any
Sheets
Data for next sheets loaded with this grid. It can be set:
a) It can be comma separated
string of the sheet id, used just to specify order of the sheets loaded in other data sources.
For example
{ Sheets:"Sheet1,Sheet2,Sheet3", Sheet:"Sheet1", Cfg: {...}, Cols: [...], Body: [...] }
b) JavaScript array of full grid JSON datas for the other sheets. Every the data object should have set the
Sheet attribute to load it to the given sheet.
For example
{ Sheets: [ { Sheet:"Sheet1", Cols: [...] }, { Sheet:"Sheet1", Body: [...] }, { Sheet:"Sheet2", Cols:[...], Body:[...] }, { Sheet:"Sheet3", Cols:[...] } ], Sheet:"Sheet3", Body:[...] }
c) JavaScript object as named array of the full grid JSON datas by sheet id.
For example
{ Sheets: { Sheet1: { Cols: [...], Body: [...] }, Sheet2: { Cols:[...], Body:[...] }, Sheet3: { Cols:[...] } }, Sheet:"Sheet3", Body:[...] }
The Sheets tag cannot be set with suffix _xxx to have defined more Sheets tags!
Cfg any
Sheets
The Sheets can be set also in the Cfg attribute in the JSON data, its meaning is the same as Source
Sheets. If set both, the Source Sheets is preferred.
The Sheets tag cannot be set with suffix _xxx to have defined more Sheets tags!
Cfg string
Book
["1"]
Workbook id the Sheet belongs to. Use when there are more books in one web page. By default all data sources have set Book from the first loaded grid, by default it is "1".
It can be placed only to Cfg tag without any suffix _xxx!
Cfg bool
Active
If set, the sheet is the one active sheet that is displayed in the
Book. If no sheet has set Active, the main loaded grid is active.
Cfg int
Hidden
If set, the sheet id is not displayed on the "
Sheets" toolbar.
If set to
2, the sheet id cannot be displayed on the "
Sheets" toolbar.
Cfg int
SheetIndex
Specifies index of the sheet displayed in "Sheets" toolbar. Use to override the order specified by loading data sources and
Sheets definition.
The SheetIndex can be any number, the toolbar just sorts the sheets according to their SheetIndex.
The SheetIndex is automatically modified on paint!
Cfg bits
ChangingSheets
[0] / [31 = 1+2+4+8+16]
How the sheets can be managed:
1.bit &
1 - sheets can be added.
2.bit &
2 - sheets can be deleted.
3.bit &
4 - sheet tab can be moved.
4.bit &
8 - sheet name can be edited.
5.bit &
16 - sheet can be shown / hidden.
If all the grid configuration changes are saved to all sheets in
Book.
It should be set the same in all the sheets.
If set to
2, it also shares chosen columns (visible and for print, export, copy &paste).
Cfg bool
SheetJs
[0]
If set, loads xlsx configuration from
Sheet.js in grid that does not load xlsx file. Applied only if set also
Book.
It can be placed only to Cfg tag without any suffix _xxx!
Toolbar string
D
= "Sheets"
Default toolbar to show sheets (all grids on page with the same
Book as this grid).
The "Sheets" toolbar displays
AddSheet button to add new sheet if some data source was loaded for
Sheet with "
+" id.
The "Sheets" toolbar provides features: to activate (display) another sheet, to change the sheets order, to rename sheet, to delete sheet and to add new sheet.
Grid method Grid
GetActiveSheet
( )
Returns active (displayed) sheet in this grid
Book.
For single grid without Book returns this grid.
To activate another sheet call ShowGrid() of the sheet that should be activated.
Grid method Grid[]
GetSheets
(bits sort = 0, bool nohidden = 0)
Returns all sheets in this grid
Book.
If set
sort&
1, sorts the array according to the
SheetIndex.
If set
sort&
2, sets
SheetIndex in all the returned grids to the index in the returned array.
If set
sort&
4, returns sheet
ids instead of Grid objects.
If set
nohidden =
1, returns only grids that have not set
Hidden attribute.
For single grid without Book returns one item array with this grid.
Grid method void
MoveSheet
(Grid next)
Moves actual sheet before the
next on "
Sheets" toolbar by updating
SheetIndex.
Grid method void
SetGridId
(string id, bool update = 0)
Changed the grid
id and the sheet name. Called on rename sheet on "
Sheets" toolbar.
If the
id is number or empty, it adds one space on its end. If there already exists grid with the
id, it modifies or add index on the end.
If set
update, updates editable formulas and names in all sheets in the book that referring old id to refer new id.
Actions
DeleteSheet
(int target = 0, bool hideonly = 0)
OnClickDeleteSheet
Deletes actual clicked sheet.
If set
hideonly, only makes the the sheet hidden and shows another one.
To hide the delete icon on the sheet button set DefTools:{ Sheet: { IconFormula:"0" } }.
Grid method bool
DeleteSheet
(bool hideonly = 0, bool nopaint = 0, bool noadd = 0)
Deletes this grid and updates active sheet. If this grid is active sheet, shows the previous or first sheet.
If this grid is the only sheet in its
Book, it adds new empty sheet or fails if set
noadd.
It fails, if the grid is not in
Book.
If set
hideonly, only makes the the sheet hidden and shows another one.
Actions
AddSheet
(int target = 0, string id = "$NewSheet")
OnClickAddSheet
Creates new sheet with given id in this grid
Book and shows the new sheet.
If there already exists grid with the given
id, it adds number suffix to the
id.
New sheet is created from the layout loaded with
Sheet="
+".
Grid method Grid
AddSheet
(string id = "$NewSheet", int noshow = 0)
Creates new sheet with given id in this grid
Book.
If there already exists grid with the given
id, it adds number suffix to the
id.
New sheet is created from the layout loaded with
Sheet="
+".
If set
noshow =
0, shows and paints the new sheet, for
1 it does not show the new sheet, but paint actual grid, for
2 it does not show the new sheet and does not paint actual grid.
Grid method void
IterSheets
(function func, any[] parameters = null, bits type = 0)
Calls function
func for every sheet (grid). It calls it as a method of the sheet.
If set
type&
1, it calls it for every sheet if set
ShareCfg, otherwise it calls it only for this one sheet that calls the
IterSheet.
If set
type&
2, it calls the
func as normal function and passes the sheet as the first parameter.
If set
type&
4, it does not call the
func for this sheet that calls the
IterSheet.
The
parameters is an array of parameters the function
func receives.
Layout and configuration
Input data are always defined as JSON in this special header:
FGrid.Data = { ... }
For example:
FGrid.Data = { Cfg: { SelectedRows:"1,3,4" }, Body: [{id:1,V:[1,4,5]},{id:2,V:[4,1,2]},{id:3,V:["A",3,4]}] }
FGrid object
Data
Base object in every input JSON data
Input data are always defined as JSON in this special header:
FGrid.Data = { ... }
For example:
FGrid.Data = { Cfg: { SelectedRows:"1,3,4" }, Body: [{id:1,V:[1,4,5]},{id:2,V:[4,1,2]},{id:3,V:["A",3,4]}] }
FastGrid base configuration.
Contains mostly string and integer type attributes, but some attributes can be also objects.
The most of the
Cfg attributes can be read by
Get /
GetCfgAttr and set by
Set /
SetCfgAttr.
Grid object
Format
Base definition in Texts.js
Language specific settings, especially for
numbers and
dates.
Contains string or integer type attributes. Cannot be read or written by API.
Grid string[id]
Text
Base definition in Texts.js
All FastGrid texts for
translations, language specific.
Contains string type attributes. Can be read by
GetTagAttr and written by
SetTagAttr.
Mouse and key action schema. Defines base handlers for FastGrid mouse and key events.
Contains string type attributes. Can be read by
GetTagAttr and written by
SetTagAttr.
Horizontal layout, defines order of row parts, toolbar parts, column tree parts and horizontal scrollbar.See more information at
RowParts.
Array of objects. Cannot be read or written by API.
Vertical layout, defines order of column parts and vertical scrollbar. See more information at
ColParts.
Array of objects. Cannot be read or written by API.
Grid object[id]
Styles
Base definition in Styles.js
Configuration attributes for individual styles set by
Style.
Contains object type attributes as the same tags in
Grid like Colors, Borders, TextStyles, ... Cannot be read or written by API.
Grid object[id]
TextStyles
Base definition in Styles.js
Configuration attributes for styling text. Values used in
TextStyle and
TextSize definitions.
Contains integer type attributes. Can be read by
GetTagAttr and written by
SetTagAttr.
Grid string[id]
Colors
Base definition in Styles.js
All RGB colors used in FastGrid, including in icons.
Contains string type attributes. Can be read by
GetTagAttr and written by
SetTagAttr.
Grid int[id]
Borders
Base definition in Styles.js
Border widths in pixels. For all FastGrid lines and borders.
Contains integer type attributes. Can be read by
GetTagAttr and written by
SetTagAttr.
Grid object[id]
CellBorders
Base definition in Styles.js
Border definitions that can be assigned to
CellBorder attribute.
Contains object type attributes as cell border definition by their id. Cannot be read or written by API.
Grid Icon[id]
Icons
Base definition in Styles.js
All
icons defined in FastGrid.
Contains object type attributes as icon definition by their id. Cannot be read or written by API.
Grid string[id]
Cursors
Base definition in Styles.js
Mouse cursor assigned for specific action.
Contains string type attributes as CSS cursor name by the action id. Can be read by
GetTagAttr and written by
SetTagAttr.
Grid string[id]
SvgDefs
Base definition in Styles.js
Icons extension, adds the strings as they are to SVG <defs> if they are referred by
def attribute in
Icons. Cannot be read or written by API.
The strings can contain SVG object definition to refer them in icons: <pattern>, <linearGradient>, <radialGradient>, <marker>, <mask>, <clipPath>, <filter>.
Grid object
Font
Base definition in Styles.js.
Defines base font used for all FastGrid texts. And defines shared settings for all other fonts set by
TextFont.
Contains mostly string and integer type attributes, but some attributes can be also objects. Cannot be read or written by API.
Cannot be set in added input data by AddData after grid is initialized.
Grid Image[id]
DefImages
Base definition in Defaults.js
Default settings for all
row cell images in FastGrid
Contains object type attributes as image definition by their id. Cannot be read or written by API.
Defined default toolbar cells that can be assigned to Tool. See more information at
DefTools.
Contains object type attributes as Tool definition by their id. Cannot be read or written by API.
Grid Toolbar[id]
DefToolbars
Base definition in Defaults.js
Defined default toolbars that can be assigned to Toolbar. See more information at
DefToolbars.
Contains object type attributes as Toolbar definition by their id. Cannot be read or written by API.
Defined default cells that can be assigned to Cell. See more information at
DefCells.
Contains object type attributes as Cell definition by their id. Cannot be read or written by API.
Defined default rows that can be assigned to Row. See more information at
DefRows.
Contains object type attributes as Row definition by their id. Cannot be read or written by API.
Defined default columns that can be assigned to Col. See more information at
DefCols.
Contains object type attributes as Col definition by their id. Cannot be read or written by API.
All predefined dialogs, menus, calendar, etc. It contains named array of all the Dialog objects their names can be used in
D when showing dialog.
Contains object type attributes as Dialog definition by their id. Cannot be read or written by API.
Grid Message[id]
Messages
Base definition in Defaults.js
All predefined messages. It contains named array of all the Message objects their names can be used in
D when showing message.
Contains object type attributes as Message definition by their id. Cannot be read or written by API.
Grid object
Script
Custom scripts definition
Assigns all the defined attributes to
Grid.Scripts.
Cannot be used with Safe:1
Use for defining custom functions like:
{ Script: { MyFunc: function(a,b,c){ return a*b/(a+c); } } } and use e.g. in formula like
Formula:"Grid.Script.MyFunc(1,3,6)"
Grid object
Events
Local API events definition
Assigns all the defined functions to the grid API events by
AddEvent.
All the attribute names must start by "On".
Cannot be used with Safe:1
Use for defining local API events assigned to only this grid like:
{ Events: { OnClick: function(G,row,col){ alert("Clicked cell "+Row.id+","+Col.id); } } }
It is not possible to define both global and local event handler for the same event!
Grid object
FGrid
Global custom scripts and API events definition
Assigns all the defined attributes to global variable
FGrid.
Cannot be used with Safe:1
Use for defining global API events assigned to all grids like:
{ FGrid: { OnClick: function(G,row,col){ alert("Clicked cell "+Row.id+","+Col.id); } } }
It is not possible to define both global and local event handler for the same event!
Data rows, columns, toolbars and images
Grid Row[]
Body / Head / Foot / {rowpartid} / {rowpartid}${colsetid}
Rows are placed in
RowPart definition of
Type="Rows" as array.
Rows usually define also their cell values, formulas, attributes and span in
V,
U,
F,
E,
A,
B,
RS,
CS and
M.
The row parts are defined in
RowParts. The predefined row parts of type "Rows" are:
Head,
Body and
Foot, but it is possible to define any other row parts.
For example:
Body:[{id:1,V:{A:"A1"}},{id:2,V:{A:"A2"}}].
To define rows for other column
set, define them with $colset suffixe, e.g.
Body$Set2:[{...},{...},{...}]
Grid Col[]
Cols / LeftCols / RightCols / {colpartid} / {colpartid}${rowsetid}
Columns are placed in
ColPart definition of
Type="Cols" as array.
The column parts are defined in
ColParts. The predefined column parts of type "Cols" are:
LeftCols,
Cols and
RightCols, but it is possible to define any other column parts.
For example:
LeftCols:[{id:"A",Type:"String"},{id:"B",Type:"Number",Format:"0.00"}].
To define columns for other row
set, define them with $rowset suffixe, e.g.
Cols$Set2:[{...},{...},{...}]
Grid Toolbar[]
Top / Bottom / {rowpartid}
Toolbars are placed in
RowPart definition of
Type="Toolbars" as array.
The toolbar parts are defined in
RowParts. The predefined row parts of type "Toolbars" are:
Top and
Bottom, but it is possible to define any other row parts.
For example:
Top:["Data","Style",{id:"Custom",Cells:[{id:"A",Type:"String",Width:100}]}].
Grid Image[]
Images
Definition list of all images in FastGrid. It contains array of
Image objects.
Grid Row[]
ChangedRows
In tag
ChangedRows are placed changed rows when uploading changed data to server or calling
GetData("changes").
The
ChangedRows tag in input data is processed the same as Body, Head, Foot, ... tags, but the items must have set
Prev or
Next attribute to specify the part to place the row to.
Grid Col[]
ChangedCols
In tag
ChangedCols are placed changed columns when uploading changed data to server or calling
GetData("changes").
The
ChangedCols tag in input data is processed the same as Cols, LeftCols, RightCols, ... tags, but the items must have set
Prev or
Next attribute to specify the part to place the column to.
Grid Tool[]
ChangedTools
In tag
Tools are placed changed toolbar cells when uploading changed data to server or calling
GetData("changes").
The toolbar cells must have set
Prev attribute to specify toolbar where they are placed.
Changes in data rows, columns, toolbars and images
If the row, column or toolbar with the same id already exists in grid,
it just sets all the attributes from new item to existing item.
The existing item is not moved, except if the new item has set
Next,
Prev or
Parent.
The values in row / column array attributes
V,
E,
F,
RS,
CS and
M are copied from new item to existing item individually.
The row / column attributes values in array attribute
A are copied from new item to existing item individually also on attribute level, if the new item attribute is object.
The toolbar
Cells are copied individually and can also define
Next,
Prev and
Remove attributes to control the position.
Output by Changed / Changes SaveFlags
To the ChangedRows / ChangedCols are filled rows / columns with these attributes, in this order:
Base
01.
id:
id - The item id. The only attribute filled always.
02.
O:
num - Item changes flags. Filled if not set
NoO.
Removed row / column
03.
Remove:
1 - The item is deleted. The item never contains any other attributes except
O:
4.
Added / moved row / column
04.
Next:
id - The item is moved or added before the Next item.
05.
Prev:
id - The item is moved or added after the Prev item.
06.
Parent:
id - The item is moved or added as the last child of the Parent, position can be more specified by Next / Prev. Sets
L as +1 of the Parent.
07.
Part:
id{$
setid} - The item is moved or added into the Part part, as the last item, position can be more specified by Next / Prev.
08.
L:
num - The item level in tree.
09.
S:
num - The item set, if not 0.
10.
D:
id - The new default item id that was changed.
11.
Add:
0 /
1 - The item has been moved or added.
Changed cells in row
12.
V:
{ cell values per column id } - The row cell values changed.
13.
E:
{ cell formulas per column id } - The row cell editable formulas changed.
14.
A:
{ cell attribute objects per column id } - The row cell style attributes changed, e.g.
A: { Col3: { Align:2, Color:"red" }, Col5: { TextStyle:1 } }.
If set
Normalize, it contains default attribute ids instead of objects like
A: { Col3:13, Col5:"DC5" }
15.
RS:
{ cell row span per column id } - The cell row span changed.
16.
CS:
{ cell column span per column id } - The cell column span changed.
Changed row / column
17.
Height:
num - The resized row height or resized column width.
18.
Hidden:
0 /
1 - The item is shown or hidden.
19.
Collapsed:
0 /
1 - The item children are expanded or collapsed.
20.
Selected:
0 /
1 - The item is unselected or selected.
21.
attribute:
value - The row / column style attributes values that have been changed.
Regex to parse the ChangedRows / ChangedCols - parses one row / column to 22 attribute values in the order listed above.
The
value can be number as is or string in " " or object in { }.
as
JavaScript RegExp /.../:
/\{(?:"?id"?:("(?:\\.|[^"])*"|[\+\-\.\w]+))(?:,"?O"?:(\d+))?(?:,"?Remove"?:(\d+))?(?:,"?Next"?:("(?:\\.|[^"])*"|[\+\-\.\w]+))?(?:,"?Prev"?:("(?:\\.|[^"])*"|[\+\-\.\w]+))?(?:,"?Parent"?:("(?:\\.|[^"])*"|[\+\-\.\w]+))?(?:,"?Part"?:("(?:\\.|[^"])*"|[\+\-\.\w]+))?(?:,"?L"?:(\d+))?(?:,"?S"?:(\d+))?(?:,"?D"?:("(?:\\.|[^"])*"|[\+\-\.\w]+))?(?:,"?Add"?:(\d+))?(?:,"?V"?:\{((?:"(?:\\.|[^"])*"|[^"\}]+)*)\})?(?:,"?E"?:\{((?:"(?:\\.|[^"])*"|[^"\}]+)*)\})?(?:,"?A"?:\{((?:"(?:\\.|[^"])*"|\{(?:"(?:\\.|[^"])*"|[^"\}])*\}|[^"\{\}]+)*)\})?(?:,"?RS"?:\{([^\}]+)\})?(?:,"?CS"?:\{([^\}]+)\})?(?:,"?(?:Height|Width)"?:(\d+))?(?:,"?Hidden"?:(\d+))?(?:,"?Collapsed"?:(\d+))?(?:,"?Selected"?:(\d+))?(?:(?:,"?\w{3,}"?:("(?:\\.|[^"])*"|[\+\-\.\w]+))*)/
as
ASP.NET @"..."
@"\{(?:""?id""?:(""(?:\\.|[^""])*""|[\+\-\.\w]+))(?:,""?O""?:(\d+))?(?:,""?Remove""?:(\d+))?(?:,""?Next""?:(""(?:\\.|[^""])*""|[\+\-\.\w]+))?(?:,""?Prev""?:(""(?:\\.|[^""])*""|[\+\-\.\w]+))?(?:,""?Parent""?:(""(?:\\.|[^""])*""|[\+\-\.\w]+))?(?:,""?Part""?:(""(?:\\.|[^""])*""|[\+\-\.\w]+))?(?:,""?L""?:(\d+))?(?:,""?S""?:(\d+))?(?:,""?D""?:(""(?:\\.|[^""])*""|[\+\-\.\w]+))?(?:,""?Add""?:(\d+))?(?:,""?V""?:\{((?:""(?:\\.|[^""])*""|[^""\}]+)*)\})?(?:,""?E""?:\{((?:""(?:\\.|[^""])*""|[^""\}]+)*)\})?(?:,""?A""?:\{((?:""(?:\\.|[^""])*""|\{(?:""(?:\\.|[^""])*""|[^""\}])*\}|[^""\{\}]+)*)\})?(?:,""?RS""?:\{([^\}]+)\})?(?:,""?CS""?:\{([^\}]+)\})?(?:,""?(?:Height|Width)""?:(\d+))?(?:,""?Hidden""?:(\d+))?(?:,""?Collapsed""?:(\d+))?(?:,""?Selected""?:(\d+))?(?:(?:,""?\w{3,}""?:(""(?:\\.|[^""])*""|[\+\-\.\w]+))*)"
as
JAVA "..."
"\\{(?:\"?id\"?:(\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+))(?:,\"?O\"?:(\\d+))?(?:,\"?Remove\"?:(\\d+))?(?:,\"?Next\"?:(\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+))?(?:,\"?Prev\"?:(\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+))?(?:,\"?Parent\"?:(\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+))?(?:,\"?Part\"?:(\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+))?(?:,\"?L\"?:(\\d+))?(?:,\"?S\"?:(\\d+))?(?:,\"?D\"?:(\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+))?(?:,\"?Add\"?:(\\d+))?(?:,\"?V\"?:\\{((?:\"(?:\\\\.|[^\"])*\"|[^\"\\}]+)*)\\})?(?:,\"?E\"?:\\{((?:\"(?:\\\\.|[^\"])*\"|[^\"\\}]+)*)\\})?(?:,\"?A\"?:\\{((?:\"(?:\\\\.|[^\"])*\"|\\{(?:\"(?:\\\\.|[^\"])*\"|[^\"\\}])*\\}|[^\"\\{\\}]+)*)\\})?(?:,\"?RS\"?:\\{([^\\}]+)\\})?(?:,\"?CS\"?:\\{([^\\}]+)\\})?(?:,\"?(?:Height|Width)\"?:(\\d+))?(?:,\"?Hidden\"?:(\\d+))?(?:,\"?Collapsed\"?:(\\d+))?(?:,\"?Selected\"?:(\\d+))?(?:(?:,\"?\\w{3,}\"?:(\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+))*)"
Regex to parse value of V [12], E [13], normalized A [14] or one A item in {}, RS [15], CS [16], attributes [22] - parses it to one single array as [colid1,value1,colid2,value2,...],
value can be number as is or string in " ".
colid is in " " only if it contains other character than [a-zA-Z0-9_].
as
JavaScript RegExp /.../:
/"(?:\\.|[^"])*"|[\+\-\.\w]+/g
as
ASP.NET @"..."
@"""(?:\\.|[^""])*""|[\+\-\.\w]+"
as
JAVA "..."
"\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+"
Regex to parse not normalized A [14] - parses it to one single array as [colid1,value1,colid2,value2,...],
value can be number as is or string in " " or object in { }.
colid is in " " only if it contains other character than [a-zA-Z0-9_].
as
JavaScript RegExp /.../:
/"(?:\\.|[^"])*"|[\+\-\.\w]+|\{(?:"(?:\\\\|\\"|[^"])*"|[^"\{\}]+)*\}/g
as
ASP.NET @"..."
@"""(?:\\.|[^""])*""|[\+\-\.\w]+|\{(?:""(?:\\\\|\\""|[^""])*""|[^""\{\}]+)*\}"
as
JAVA "..."
"\"(?:\\\\.|[^\"])*\"|[\\+\\-\\.\\w]+|\\{(?:\"(?:\\\\\\\\|\\\\\"|[^\"])*\"|[^\"\\{\\}]+)*\\}"
?? Row, Col, Toolbar, Tool, Part string / int
Next
Places the item (row, column, toolbar, toolbar cell, row part or col part) before the item with
id =
Next.
If the
Next item does not exist, places the item as the last item in the part or parent.
If used in many rows / columns in data during FastGrid creating, it can remarkably slow down the creating!
If the parent contains the first item as "", it automatically sets to all items in the section Next:"" to reorder already existing items in given order.
For example:
Cols:["","A",{id:"B",Width:100},"C"] is taken as
Cols:[{id:"A",Next:""},{id:"B",Width:100,Next:""},{id:"C",Next:""}]
?? Row, Col, Toolbar, Tool, Part string / int
Prev
Places the item (row, column, toolbar, toolbar cell, row part or col part) after the item with
id =
Prev.
It is ignored, if the
Next attribute is defined.
If the
Prev item does not exist, places the item as the first item in the part or parent.
If used in many rows / columns in data during FastGrid creating, it can remarkably slow down the creating!
?? Row, Col string / int
Parent
Specifies parent or part of the row / column.
If set
Next and not set
L, just changes the row or column
L to the
Prev.
L + 1.
Otherwise places the row or column as the last child of the row / column with
id =
Prev or as the last row in
Part Prev.
If the
P row / column / part does not exist, does nothing.
If used in many rows / columns in data during FastGrid creating, it can remarkably slow down the creating!
Row, Col string
Part
Part id where the row / column is placed. It can contain also Set as {Part_id$Set_id}, e.g. Part:"Body$2".
If it is not set and Parent/Prev/Next are also not set, the added row / column is placed to
DefRowPart /
DefColPart.
Row string / int
NewId
It can be filled only in response sent from server to FastGrid.
It changes the row
id to this value.
Tool string
Toolbar
Toolbar where the cell is placed in, used in changed toolbar cells in
ChangedTools tag.
Image int
Index
If set, places the image to given index. If there is already an image on the index, merges the images according to the
Remove value.
Row, Col, Toolbar, Tool, Image, Part int
Remove
[0]
What to do if there is item (row / column / toolbar / toolbar cell / image / row part / col part) with the same
id already in the grid.
0 | change | Changes the existing item attributes by the new item attributes. To also move the item set Prev / Next attribute. |
1 | remove | Removes the existing item and does not add the new item. |
2 | remove + add | Removes the existing item and places the new item on its new position. |
3 | replace | Removes the existing item and places the new item instead of the removed item. |
Row, Col, Toolbar, Tool, Image, Part bool
Add
[1]
If adds the new item when it does not exist in the grid yet. By default is true.
Toolbar, Tool bool
All
If set and the toolbar cell does not exist in its toolbar yet, it is searched in all toolbars. If found only once, it is removed from old destination and added to its toolbar, even if it has set
Add = 0.
The toolbar cells should have set their ids unique among all toolbars.
Actual state of the row or column:
&
1 - any row cell changed according to the
CellChanges.
It is not set in column!
&
2 - added
&
4 - deleted - will be removed after accepting changes
&
24 - moved (
8 - moved with parent,
16 - moved inside parent,
24 - moved to another parent or every move)
according to
RowChanges /
ColChanges &
24.
&
32 - resized
&
64 - shown / hidden. See also
Hidden attribute.
&
128 - changed row / column style attribute (e.g. Color or TextSize).
&
256 - expanded / collapsed children. See also
Collapsed.
&
512 - selected / unselected. See also
Selected attribute.
&
1024 - row / column added by
Auto part.
&
2048 - manually hidden row / column if it does not have set
NoHide.
Grid method string / object
GetData
(string flags = SaveFlags, int format = 0)
Returns FastGrid data according to the
flags in given
format. The returned data can be passed back to FastGrid in its input data or by
AddData.
format = returned format =
0 - json in string,
1 - json object.
flags - what and how is filled in returned data, comma separated list or array of string flags, cases insensitive.
flags for changes |
Changed |
Fills changed rows in ChangedRows array (if set RowChanges or CellChanges).
Fills changed columns in ChangedCols array (if set ColChanges).
Fills changes toolbar cells in ChangedTools array (if set ToolChanges).
|
Changes |
Fills changed rows, column and toolbars to their parts instead of ChangedRows / ChangedCols / ChangedTools.
Ignored if set Changed flag.
|
| |
State | Fills also attributes
Add=1 for added item (O&2),
Remove=1 for deleted item (O&4),
Add=0 for moved item (O&24),
Hidden=1 for O&64,
Collapsed=1 for O&256,
Selected=1 for O&512.
Note, for resized item (O&32) is always filled attribute Width or Height.
|
NoO | Does not fill O attribute. It still fills O values 2 (added) and 4 (removed) if not set State flag. |
NoL | Does not fill L attribute. |
NoL0 | Does not fill zero value in L attribute. |
Reverse |
If not present, fills the changed items in normal (not reversed) order. Fills always the Prev attribute for moved / added rows, except if set Next flag without Prev.
If present, fills the items in reversed order, so the Next always points to already created or moved items. Fills always the Next attribute for moved / added rows, except if set Prev flag without Next.
|
Parent | Fills parent row / column in the Parent attribute. Never fills it for root rows / columns. |
Next | Fills the next row / column in the Next attribute either without flag Reverse. Does not fill Prev except if set flag Prev. |
Prev | Fills the previous row / column in the Prev attribute either with flag Reverse. Does not fill Next except if set flag Next. |
DefPart | Fills the Part attribute also for rows in part DefRowPart and for columns in part DefColPart. |
AddV | Fills all cell values for added rows. For not set values fills empty string. Can be used also with VArray and Def flags. |
Normalize | Normalize attributes in A tag when filling cell attributes in rows.
Fills the A always with number references to DefCells instead of attribute objects.
Fills also all the added default cells in DefCells, but only once (they will not be uploaded in next uploads).
|
ParentId |
Fills parent row / column id in the id, Parent, Next and Prev attributes. For root row / column adds nothing. Seaparates the ids by SaveIdSeparator.
Cannot be used for moved rows / column if set RowChanges / ColChanges & 24 (only 8 and 16 bit values are permitted here).
|
flags for full data |
{partid} | Fills all rows, column or toolbar from given part in the array named as the part.
For example GetData("Body,Cols") returns {Body:[...],Cols:[...]} as all rows from Body part and all columns from Cols part.
The cells are filled in rows in V / U / A
/ B / E / F / RS / CS / M attributes.
In toolbars the cells are filled in Cells array.
Columns never contain cells.
The rows / columns / toolbars / tools contain all their attributes explicitly set. If set defaults flag, they contain also all default values from their default item.
|
| |
VArray | Fills row cell values in V attribute as array according to VIndex instead of object by column ids. Used only when filling whole parts and for added rows with Changes AddV. |
AArray | Fills row cell attributes in A attribute as array according to AIndex instead of object by column ids. Used only when filling whole parts and not with Changes and Cookie flags. |
NoE | Does not fill attribute E in rows, but fills the results of the formulas to V. Used only when whole parts and not with Changes and Cookie flags. |
NoU | Does not fill attribute U in rows. Used only when whole parts and not with Changes and Cookie flags. |
NoB | Does not fill attribute B in rows. Used only when whole parts and not with Changes and Cookie flags. |
NoL | Does not fill attribute L. |
NoEmpty | Does not add rows or columns with only id set. Used only when whole parts and not with Changes and Cookie flags. |
Deleted | Saves also deleted rows, only with id and Remove:1 attributes. Used only when whole parts and not with Changes and Cookie flags. |
Normalize | Normalize attributes in A tag when filling cell attributes in rows. For {partid} and Changes flags
Fills the A always with number references to DefCells instead of attribute objects.
|
Def | If present, fills row, column, cell, toolbar and tool attributes including values from their D. |
flags for layout |
Images | Fills all images in Images array. |
DefRows | Fills all default rows in DefRows object by the default row id. |
DefCols | Fills all default columns in DefCols object by the default column id. |
DefCells | Fills all default cells in DefCells object by the default cell id. |
DefToolbars | Fills all default toolbars in DefToolbars object by the default toolbar id. |
DefTools | Fills all default toolbar cells in DefTools object by the default toolbar cell id. |
DefImages | Fills all default images in DefImages object by the default image id. |
Cfg | Fills configuration attributes in Cfg tag. |
Format | Fills format attributes in Format tag. |
Text | Fills language texts in Text tag. |
Actions | Fills actions in Actions tag. |
Styles | Fills special style attributes in Styles tag. |
Colors | Fills all rgb colors in Colors tag. |
Borders | Fills all border widths in Borders tag. |
CellBorders | Fills all cell borders in CellBorders tag. |
Icons | Fills all icons in Icons tag. |
Cursors | Fills all cursors in Cursors tag. |
SvgDefs | Fills custom svgdefs for icons in SvgDefs tag. |
Font | Fills actual font attributes in Font tag. |
RowParts | Fills all row parts in RowParts array. Always fills all row parts, regardless the defaults flag. |
ColParts | Fills all column parts in ColParts array. Always fills all column parts, regardless the defaults flag. |
Dialogs | Fills all dialogs in Dialogs object by the dialog id. |
Messages | Fills all messages in Messages object by the message id. |
| |
AllDef | Fills all defaults (shortcut for flags DefRows, DefCols, DefCells, DefToolbars, DefTools, DefImages). |
All | Fills the whole grid data (shortcut for all data flags except Changes and Cookie) |
| |
Defaults | If present, fills all data also from default data in Defaults.js / Styles.js / Text.js. For all layout flags except RowParts and ColParts. |
flags for cookies |
Cookie | Fills all actual settings according to the Cookie definition. |
Cookies | Fills all configurations in Cookies. |
| |
Null | If present, fills also all null values. |
Def | If present, fills row, column, cell, toolbar and tool attributes including values from their D. |
flags for json |
Quote | If present, quotes all attribute and tag names for compatibility with exact JSON definition. |
Strings | If present, quotes also all number values for compatibility with some JSON parsers. It should not be used for data passed back to FastGrid! |
LF | Adds \n after tags, just for better display of the output JSON. |
AddData | If present, adds FGrid.Data= on the start of the returned string. |
AddBom | If present, adds UTF8 BOM on the start of the returned string. |
other flags |
Print | Fills Print settings in Cfg tag, to be set to PDF printing. |
Selected | Fills SelectedRows and SelectedCols in Cfg tag. |
Grid method void
AcceptChanges
( )
Accepts all pending changes. Clears all
O attributes and removes deleted rows and columns.
Grid method void
HasChanges
( )
Returns true if grid has some pending changes according to the
RowChanges /
ColChanges and
CellChanges.
If the changes are checked before reload or to enable Save icon.
0 - The changes are not checked, the grid is always marked as changed, the
HasChanges always returns true.
1 - The grid is marked changed after the first change and the flag is removed only by
AcceptChanges.
2 - The grid is marked changed after any change and the flag is removed whenever the grid returns to original state or by
AcceptChanges. It can be slow for large grids, so
MaxCheckChanges is appllied.
When count of rows in the grid exceeds this value, the
CheckChanges is switched from
2 to
1. To speed up checking changes.
Saving changes to server
The changes or partial or whole grid data can be got by JavaScript API method
GetData.
Or they can be sent to server by AJAX using method or action
Save.
An url to upload changes or full changed data to server. What will be uploades is controlled by
SaveFlags.
It can be set to string as direct url or to object as
Source, with attributes
Url,
Data,
Add,
Param,
Header,
Sync,
User,
Pass,
Safe,
Encode,
Debug.
If not set
Method, it is used as AJAX "post".
Data are uploaded in the POST parameter named "
Data". It can be changed by
SaveParamName.
The server response must not be empty! The simplest successful response is "
{}" or "
{IO:{Result:0}}".
If set to
{Debug:2}, it shows the saved data without uploading.
If set to
{Export:1}, it exports full data by action
Export instead of uploading. It is set in Sheet by default.
To avoid ASP.NET validation of < and & in the request data, set Encode = 1 or Cfg SaveEncode = 1.
Used only for SaveFormat = json.
Specifies what changes or data will be sent to server on save. The same options as
flags in
GetData.
Format of uploaded data. It can be set to
json or
xlsx.
If set to
xlsx, it ignores
SaveFlags and uploads the whole grid in xlsx file.
Uses values of these column cells or row attributes instead of row
id when saving changes. Fills them in the uploaded attributes
id,
Parent,
Next and
Prev.
Used only for
Changes /
Changed SaveFlags.
Uploads original cell values since last save, not changed cell values.
Separates the values by
SaveIdSeparator - the values must not contain it.
For example
SaveIdCols="A,D,id" uploads the id as value of column "A" and attributes row.D and row.id. If in the grid are columns "D" or "id", they are used instead of attributes.
Separates the individual ids if used
SaveIdCols and / or
ParentId in
SaveFlags.
Name of the POST parameter where to upload the data.
String added before all custom relative urls. It should end by slash '/'.
It is also generated from actual url when
Save data by "Print" option.
If set to
0, it saves only this grid.
If set to
1, it saves all sheets together according to their
NoSave attribute.
If set to
string as comma separated list of grid ids, saves these grids together, regardless on their
NoSave attribute.
Comma separated list of Cfg attributes their change in Settings menu sets
GridChanged and the grid is marked as changed.
If set, the grid is marked as changed and the
HasChanges() returns true.
If shows message on sucessful save.
0 - no,
1 - for short time,
2 - for longer time,
3 - with OK button,
string - this message, with OK button.
If the grid saving is restricted.
Only for SaveGrids = 1.
-2 - grid is saved always and not shown in sheets in Save menu,
-1 - grid is saved always,
0 - grid is saved only if it is not
Hidden,
1 - grid is not saved,
2 - grid is not saved and not shown in sheets in Save menu.
1. bit &
1 - if set, the row / column / toolbar will be not uploaded in save response.
2. bit &
2 - if set, the row / column / toolbar is not used as Prev / Next / Parent in save response.
Source int
Debug
Source attribute special to
SaveUrl. If set to
1 it prints to debug the saved response. If set to
2, the
SaveUrl is used only for debugging the response.
IO int
Result
[0]
It can be filled in save response JSON data in IO tag.
Result of the saving. If set negative, the changes are not accepted and it shows error message.
IO string
Message
Message shown in grid after save as
Ok message for
Result>=0 or
Error message for
Result<0.
IO string
MessageD
Message default for IO
Message.
IO bool
Reload
[0]
If set, it fully reloads the grid from server.
IO bool
Accept
[1]
If set to
0, does not accept changes done by adding the response data to grid.
Actions
Save
(int target = 0, bits validate = 0)
OnClickSave
Saves changes to server.
If set
validate&
1, it checks if the grid has some changes and fails if no changes are pending.
If set
validate&
2, calls also action
Validate and fails if the Validate fails.
Grid method bool
Save
(bits validate = 0)
Saves changes to server.
If set
validate&
1, it checks if the grid has some changes and fails if no changes are pending.
If set
validate&
2, calls also action
Validate and fails if the Validate fails.
API event bool
OnSave
(Grid grid, Source source, Grid[] grids)
Called before the grid changes are saved to server, before the uploading starts.
source is the
SaveUrl, it is always object and it is copy of the original object and can be changed to modify the communication.
Grids is array of all grids being saved.
Return true to suppress the save action.
API event string
OnSaveChanged
(Grid grid, Row / Col item, string data)
Called for every saved row or column when saving changed rows / columns (flags
Changed or
Changes).
data is JSON string that is saved for given row / column. It does not end by comma, e.g. "{id:1,Add:1".
Add or modify the
data and return it from the event handler, e.g.
return data+",Value:\""+r.Value.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")+"\"";
Use double quotes to quote the values, remember to replace the " and \ characters.
API event object
OnSaveXlsxError
(Grid grid, Source source, Grid[] grids)
Called when failed generating xlsx to save to server by
SaveFormat =
xlsx
No communication with server done.
Return true to not display error message.
API event object
OnSaveError
(Grid grid, Source source, int code, string message, Grid[] grids)
Called when loading of server response failed.
Returning null or false will end saving, will not accept the changes and show error message.
Returning true will end saving, will not accept the changes, but will not show error message.
Returning JSON object will continue with it as a response from the errorneous data source and will accept changes and show no error message.
source is the
SaveUrl, it is always object and it is copy of the original object, but has no sense to change it.
Grids is array of all saved grids.
The
code and
message are the same as
OnLoadError.
API event any
OnSaveAccept
(Grid grid, Source source, object data, Grid[] grids)
Called after received sucessfully the server response, before the returned JSON
data are added to grid and changes are accepted.
source is the
SaveUrl, it is always object and it is copy of the original object, but has no sense to change it.
Grids is array of all saved grids.
Return true to not add the
data and not accept the changes.
Return object as new data to add to grid instead of the
data.
API event bool
OnSaved
(Grid grid, Source source, Grid[] grids)
Called after the grid changes are saved to server and sucessful response received and all the changes are accepted by
AcceptChanges.
source is the
SaveUrl, it is always object and it is copy of the original object, but has no sense to change it.
Grids is array of all saved grids.
Return true to not show
SaveMessage.
Mark changes
Cell changes that are stored and can be marked or uploaded.
&
1 - values, &
2 - attributes, &
4 - row & column span.
How marks the changed cells and the cells with editable formula / error and read only / editable cells.
0 - no,
1 -
8 -
Mark icon in given corner -
1 - at top left, to right,
2 - at top left, to down,
3 - at top right, to left,
4 - at top right, to down,
5 - at bottom right, to left,
6 - at bottom right, to up,
7 - at bottom left, to right,
8 - at bottom left, to up,
9 - background color,
10 -
not used,
11 -
18 - background color and
Mark icon in given corner (like
1 -
8).
What is marked in cells by
MarkCells.
&
1 - cell changes defined by
CellChanges, &
2 - editable cells, &
4 - read only cells,
&
8 - cell with editable formula, &
16 - cell with error in editable formula, &
32 - editable cells in not editable grid or not editable cells in editable grid
Row changes that are stored and can be marked or uploaded.
&
1 - cell changes, marks row as changed if any of its cell changed according to the
CellChanges. If not set, the changed cells are still marked and can be uploaded.
&
2 - added,
&
4 - deleted - if not set, the deleted rows are removed and cannot be undeleted or shown,
&
24 - moved (
8 - only to another parent (as 24 in
O),
16 - also inside (as 16 in
O) and with parent (as 8 in
O),
24 - every move, does not differ, (always as 24 in
O and cannot use
ParentId in
SaveFlags),
&
32 - resized,
&
64 - shown / hidden,
&
128 - row attributes, marks row as changed if any its style attribute (e.g. Color or TextSize) changed,
&
256 - expanded / collapsed children,
&
512 - selected / unselected.
&
1024 - count of added / removed rows, for checking if the grid has some changes. If not set &
2 and &
4.
How marks the changed rows by
RowChanges.
0 - no,
1 -
8 -
Mark icon in given corner -
1 - at top left, to right,
2 - at top left, to down,
3 - at top right, to left,
4 - at top right, to down,
5 - at bottom right, to left,
6 - at bottom right, to up,
7 - at bottom left, to right,
8 - at bottom left, to up,
9 - background color,
10 -
not used,
11 -
18 - background color and
Mark icon in given corner (like
1 -
8).
Column id where will be shown mark icons for
MarkRows.
Column changes that are stored and can be marked or uploaded.
By default no column changes are stored.
&
1 - cell changes, marks columns as changed if any of its cell changed according to the
CellChanges. If not set, the changed cells are still marked and can be uploaded.
&
2 - added,
&
4 - deleted - if not set, the deleted columns are removed and cannot be undeleted or shown,
&
24 - moved (
8 - only to another parent (as 24 in
O),
16 - also inside (as 16 in
O) and with parent (as 8 in
O),
24 - every move, does not differ, (always as 24 in
O),
&
32 - resized,
&
64 - shown / hidden,
&
128 - column attributes, marks column as changed if any its style attribute (e.g. Color or TextSize) changed,
&
256 - expanded / collapsed children,
&
512 - selected / unselected.
&
1024 - count of added / removed columns, for checking if the grid has some changes. If not set &
2 and &
4.
How marks the changed columns by
ColChanges.
0 - no,
1 -
8 -
Mark icon in given corner -
1 - at top left, to right,
2 - at top left, to down,
3 - at top right, to left,
4 - at top right, to down,
5 - at bottom right, to left,
6 - at bottom right, to up,
7 - at bottom left, to right,
8 - at bottom left, to up,
9 - background color,
10 -
not used,
11 -
18 - background color and
Mark icon in given corner (like
1 -
8).
Row id where will be shown mark icons for
MarkCols.
Toolbar cell changes that are stored and can be marked or uploaded.
By default no toolbar changes are stored.
&
1 - values, &
2 - attributes.
How marks the changed toolbar cells and read only / editable cells.
0 - no,
1 -
8 -
Mark icon in given corner -
1 - at top left, to right,
2 - at top left, to down,
3 - at top right, to left,
4 - at top right, to down,
5 - at bottom right, to left,
6 - at bottom right, to up,
7 - at bottom left, to right,
8 - at bottom left, to up,
9 - background color,
10 -
not used,
11 -
18 - background color and
Mark icon in given corner (like
1 -
8).
What is marked in toolbar cells by
MarkTools.
&
1 - toolbar cell changes defined by
ToolChanges, &
2 - editable toolbar cells, &
4 - read only toolbar cells.
If set, the changes in the cell (value, editable formula, attributes) are not maintained.
Loading children on expand parent
If set, the row downloads its child rows from
ChildrenUrl on its expand.
This number is shown on the Collapse icon as number of row's children when set
ExpandDigits.
Ignored, if the row is expanded as Collapsed = 0!
If the row has already some children, the loaded children are added to them.
It is automatically set negative during loading the children.
It is automatically set to 0 after loaded the children, except if set
ChildrenReload.
Deepness of the nested levels by
Children attribute. By default it is 1 for 1 nested levels.
An url to load child rows from server when expanding row with
Children attribute.
It can be set to string as direct url or to object as
Source, with attributes
Url,
Data,
Add,
Param,
Header,
Sync,
User,
Pass,
Safe,
Debug.
If not set
Method, it is used as AJAX "get".
The url string can contain keyword
*Row to be replaced by the row
id that is being expanded.
The ids of rows being expanded are uploaded in parameter named
Rows, comma separated. It can be changed by
ChildrenParamName.
The loading is asynchronous, the row expand buttons shows wait icon during loading.
The server response should contain new rows to be added to grid, usually with
Parent attribute to be added to the row being expanded.
For example:
FGrid.Data = { Body:[ { id:71, Parent:7, V: { A:"Added 7-1" } }, { id:72, Parent:7, V: { A:"Added 7-2" } }, { id:73, Parent:7, V: { A:"Added 7-3" } } ] }
An url to load child rows from server when expanding this row with
Children attribute, used instead of Cfg
ChildrenUrl.
If set, the
ChildrenUrl is loaded on every expand. If not set, the children are loaded only on the first expand.
If set, the
ChildrenUrl is loaded on every expand of this row. If not set, the children are loaded only on the first expand, used instead of Cfg
ChildrenReload
Parameter name where to include ids of the rows that are being expand. The ids are comma separated.
If set, loads all children of rows with
Children attribute on print, if
PrintRowsType contains "
Collapsed".
If set, loads all children of rows with
Children attribute on export, if
ExportRowsType contains "
Collapsed".
String added before all custom relative urls. It should end by slash '/'.
It is also generated from actual url when
Save data by "Print" option.
Grid method void
LoadChildren
(Row / Row[] rows, function func)
Starts loading children from
ChildrenUrl of the parent
rows.
func is called after finish. If the
func returns true, the
Paint is not done.
Grid method bool
LoadAllChildren
(function func)
Starts loading all children from
ChildrenUrl for all rows in grid.
func is called after finish. If the
func returns true, the
Paint is not done.
If there is no parent row to load its children, returns false and does
not call
func.
Returns true, if the loading started.
API event bool
OnLoadChildren
(Grid grid, Row[] rows, Source source)
Called before child rows of parent
rows are loaded from
source.
source is copy of the
ChildrenUrl and can be modified in this event handler. It can be also array of sources if the
rows contain more parents.
Return true to not load the children.
API event void
OnLoadedChildren
(Grid grid, Row[] rows)
Called after all the children of the parent
rows are loaded, before
paint.
Short format
In input data it is possible to code the data as short as possible in short format.
The row cell values and cell attributes can be coded into Unicode strings in
U and
B attributes using
WriteValue() function.
The whole RowPart or ColPart can be coded into Unicode strings using short format by
WriteValue() function, e.g.
{ Cfg:{...}, Body:"...", Cols:"..." }
In the short format are also permitted variable length strings (
WriteValue ucode &
0x80).
If the part has
not set
Par, the first char(s) in the part string is number or name of
Par, coded by
WriteValue ucode =
ParUCode.
The next chars are values according to the
Par definition, coded by
WriteValue.
The number of values in the RowPart / ColPart string is (0 or 1) + Par length * (row/col) count.
Grid any
Par
Array of object defining attributes for short format.
The Par definition can be set as: a)
string as shortcut for Par:"..." => Par:["..."], b)
array as Par:[[],[],[],...], c)
object as Par:{Name1:[],Name2:[],Name3:[],...}.
The short format refers the individual Par items by the array index or the object attribute name.
The individual Par item can be first character separated string or an array as:
"|attr1|ucode1|attr2|ucode2|attr3|ucode3|..." or ["attr1",ucode1,"attr2",ucode2,"attr3",ucode3,...].
attr is the row / column attribute name, the
ucode is a number as value format used by
WriteValue.
Or the
ucode can be an object with possible attributes:
UCode (the number format, required),
Texts as the first texts,
UTexts as the ucode2 results or second texts.
For example:
[["id",0x11,"L",0x1,"S",0x1,"U",0x200C],["id",{UCode:0xC4,Texts:"|aaa|bbb|ccc|ddd|eee"},"UCode",0x1,"Width",0x1,"UIndex",0x11]] - the first par has name/index 0, the second part 1.
If there are defined more Par tags and some item has the same index / name as already existing item, the old item is replaced by the new item.
Part string[]
Par
Comma separated string list or array of
Par ids that will be periodically used for loaded rows (columns).
For example
Body_Cfg: { Par: "P1,P2,P3" }, the first row is coded by par P1, the second by par P2, the third by par P3, the fourth by P1, the fifth by P2, etc.
If the part does not have set the
Par attribute, the first char(s) of every row (column) definition is id of the
Par, coded as
WriteValue ucode =
0x81.
Cfg int
ParUCode
[0x41]
ucode used for encoding
Par number or name.