TreeGrid v6.0
Cells
<C> <cell> string Type [“Text”] .
Cell type. Specifies the basic behavior of the cell. How it will be displayed, edited, calculated sorted, filtered and so on.
Editable types
Text One line text, formatted, edited in <input>.
Lines Multi line text, formatted, edited in <textarea>, can accept Enters.
Int Integer number, formatted, edited in <input>.
Float Floating point number, formatted, edited in <input>.
Date Date and / or time, formatted, edited in <input> or selected from popup calendar.
Pass Password. It is displayed as “***”, editing in <input type=”password”>
Img Editable image. Displayed as <img> tag or as background image in <div>. For simple not editable image use Icon type.
Link Editable link to any url. For simple not editable link use Link attribute with any type.
Changeable types
Bool Boolean value 1 and 0 – it is displayed and edited as checkbox.
Radio Enumeration with radio buttons instead of combo box. Displayed and edited as radio buttons or checkboxes.
Enum Combo box to select one or more values from menu.
Select Cell with predefined values chosen from menu. It is shortcut for Button of type Defaults with non-editable Html cell.
Button types
Button One button in cell: clickable button, switch button, radio / tab button, menu button, combo switch button, combo radio / tab button.
Panel One or more clickable buttons in cell.
Special interactive types
Pager Special simple pager cell, only for Space rows. Displays buttons GoFirst,GoPrevious,GoNext,GoLast and editable cell with page number and number of pages.
Pages Special simple page links, displays links for all pages as numbers from 1.
DropCols Drop target to drag column names here. Only for cell in Space rows.
Gantt Interactive Gantt chart. This type must be used for <C> tag only.
Not editable HTML types
Html Any HTML code displayed as is.
Icon Simple image
Abs HTML elements absolutely positioned inside the cell in layers. It does not affect row height, it is always overflowed.
List List of items to build an HTML string.
API event string OnGetType (TGrid grid, TRow row, string col, string type) .
Called whenever grid reads the cell type to change the Type dynamically. It must be very fast.
Returns new type or type.
API method string GetType (TRow row, string col) .
Returns cell Type in string. Just reads all appropriate Type attributes and calls OnGetType.
Cells are formatted according to its type. Individual formats are described in individual types documents.
<C> <cell> string Format .
Specifies a cell format for display, its presence, meaning and structure varies according to cell type and is described for individual types.
<C> <cell> string EditFormat upd 6.0.
Specifies a cell format for editing, its presence, meaning and structure varies according to cell type and is described for individual types.
API event string OnGetFormat (TGrid grid, TRow row, string col, string format, bool edit) .
Called to get cell format dynamically. Returns new format or format. It must be very fast.
If edit is false returns standard format, for true returns format for editing.
API method string GetFormat (TRow row, string col, bool edit = false) .
Returns format string for given cell. If edit = true, returns EditFormat. Calls also OnGetFormat.
<cell> string value Uploaded to server when Added or Changed, supports Undo .
Cell value in the row. It cannot be set into the whole column, to preset default value to more or all rows in some column use default <D> rows.
The value is not an attribute name! The cell value is set as assignment to column name in row, e.g <I Col1=’value of col1’ Col2=’value of col2’ Col2CanEdit=’0’/>.
Floating point numbers always use ‘.’ as decimal separator and no thousands separator.
Date and time values are in XML in string in English format (M/d/yyyy HH:mm:ss) and in API are in number of milliseconds from 1.1.1970 00:00:00.000.
By API you can read the value by GetValue, GetString or by global functions Get or Is.
By API you can set SetValue / SetString. You can set the value also directly by row[col] = val, but without any update and refresh.
API event string OnGetHtmlValue (TGrid grid, TRow row, string col, type val) .
Called to get formatted cell value to display. val is unformatted cell value.
Returns formatted value. If returned value is not null, it is used instead of internal formatting by Format or Enum attributes.
Return null to use default formatting behavior.
API method type GetValue (TRow row, string col) .
Returns cell value as number or string, for date returns internal format (count of msec from 1/1/1970).
The cell value can be set by SetValue method.
API method string GetString (TRow row, string col) .
Returns cell value as string, in standard format (non editing).
The cell value as string can be set by SetString method.
API method void StartUpdate ( ) new 6.4 .
Call it before mass update of cell values, adding more rows, showing / hiding more rows and so on.
It disables calculations, updating layout, uploading changes with AutoUpdate and updating Gantt chart. It also starts Undo block.
It is possible to nest blocks StartUpdate/EndUpdate.
API method void EndUpdate (TRow row = null, string col = null ) new 6.4 .
Call it after the action for StartUpdate finished.
It enables calculations and recalculates grid. If set row and col it recalculates grid like after change the cell, otherwise it recalculates the whole grid.
It updates grid layout by calling Update.
It enables AutoUpdate and uploads changes to server. If set row, it uploads only changes in the row, otherwise it uploads all changes.
It updates Gantt chart and dependency.
It closes the Undo block, all actions within StartUpdate and EndUpdate will be undone or redone together.
global func. object Get (TRow row, string attr) .
Returns value of row’s attribute. Remember, all attributes are often of string types. If the row has not this attribute set, it returns default value from its default row.
To get cell attribute use Get(row,col+”attr”), e.g. Get(row,”Col1CanEdit”)
global func. bool Is (TRow row, string attr) .
Returns true if row’s attribute has positive value, returns false for 0 or null. Remember, all attributes are often of string types.
If the row has not this attribute set, it returns default value from its default row.
API method string GetAttribute (TRow row, string col, string attribute) new 6.0 .
Returns a cell (<I>), row (<I>) or column (<C>) attribute, in this order.
If row is null, returns only column attribute
If col is null, returns only row attribute.
If attribute is null, returns cell value as internal value. To get cell value as string use GetString method.
Example: grid.GetAttribute(row,col,”CanEdit”);
API method string SetAttribute (TRow row, string col, string attribute, string value, bool refresh, bool undo) new 6.0 upd 6.4.
Sets a cell (<I>), row (<I>) or column (<C>) attribute to the value and refreshes it.
Remember, not all attributes can be set via this method! If there exists a direct API method for setting the attribute, use it instead !
If row is null, sets only column attribute. In this case the refresh of the whole column can be slow!
If col is null, sets only row attribute and refreshes the whole row
If attribute is null, sets cell value via SetString method.
If set undo adds the change to Undo and can undone and redone.
Example: grid.SetAttribute(row,col,”CanEdit”,0,1);
API method void RefreshCell (TRow row, string col) .
Refreshes cell’s html element, re-renders the whole cell.
Call it after any change that affects the cell, like when you directly set its value by row[col] or any attribute by row[col+attribute]
API method void RefreshRow (TRow row) .
Refreshes row’s html element, re-renders whole row.
Call it after any change that affects the whole row, like changing its Class.
The API functions for changing rows like DeleteRow do the changes automatically.
It is faster than refreshing all cells in row by RefreshCell.
API method object GetCell (TRow row, string col) chg 6.0 .
Returns HTML cell element, tag <TD>.
Don’t change the HTML directly! To change the cell content use some grid method to change data and call RefreshCell.
You should use this method only if you really know what are you doing.
Remember, TreeGrid can anytime re-render the cell and any your custom changes done in the HTML will be lost.
<C> <cell> bool Range [0] .
If the cell accepts a range or more values. Usable especially in filter cell or in Gantt source cells.
Cell types Int, Float and Date accept more values separated by ‘;’ and range of values separated by ‘~’. For example “1;3~7;12;16~33” or “1/1/2000~3/3/2000;1/1/2007”.
Calendar component for selecting date supports selecting more dates or range of dates by mouse drag.
Cell types Enum and Select can select more values from combo box. Defaults dialog supports selecting more values for any cell type.
Cell types Text and Lines accepts more strings separated by ‘;’.
The characters ‘;’ and ‘~’ can be changed by <Lang><Format ValueSeparator=’;’ RangeSeparator=’~’/></Lange>
The range value should not be used as input for calculations, because formulas treats is as single string.
Sorting of range value is done only according to the first value ascending and the last value descending.
Filtering is done only according to the first value.
Search and group treat the range value as single string.
<Format> string ValueSeparator [;] .
Separator to separate individual values in Range cell. This separator must not be contained in any individual value.
This separator is used in the value itself and for editing.
The default is semicolon.
<Format> string ValueSeparatorHtml [; ] .
A string displayed in cell instead of ValueSeparator in Range cell.
The default is semicolon + space.
<Format> string RangeSeparator [~] .
Separator to separate the bounds in Range cell. Used only for number types, Int, Float and Date.
This separator is used in the value itself and for editing.
The default is tilde.
<Format> string RangeSeparatorHtml [ ~ ] .
A string displayed in cell instead of RangeSeparator in Range cell. Used only for number types, Int, Float and Date.
The default is space + tilde + space.
Cells can display it content as clickable link (<A HREF>).
The cell must not be editable to process the link click or the editing must not be started on click.
Only types Html, Img, Text, Lines, Int, Float and Date can have a link.
<C> <cell> string Link new 6.0 .
The link URL (<A HREF>). If set, the cell has a link and browser will be navigated to this link after click to the link.
Remember, the cell must not be editable to process the link click or the editing must not be started on click.
<C> <cell> string LinkTarget new 6.0 .
The link target (<A TARGET>). Name of browser window to open the link here.
It can be “_blank” to open in new window or “_top” to open in main frame.
By default the link opens in the same window.
<Cfg><C><cell> string LinkBase new 6.0 .
Link base url prefix.
This string is added before the Link. To easily change an url of more links together.
The hint is a complete cell value displayed in place of the cell, if the cell content is bigger than the cell itself.
The hint can also display anything else than the cell content, it can be changed in OnHint event.
The hint is displayed immediately the mouse enters the cell and is displayed until the mouse leaves the cell or click happens or grid enters edit mode or shows dialog.
<C><I><cell> bool ShowHint [1] .
If the Hint is shown for the cell.
The Hint is never shown for cell types Radio, Abs and Gantt.
API event string OnHint (TGrid grid, TRow row, string col, string hint) .
Called when Hint is being displayed.
Return new string to display or hint. hint is by default cell html content.
Return null to not display the Hint.
<Actions> ShowHint Attached to events OnMouseOverContent and OnMouseOverCaption .
Displays value of the actual cell as Hint, only if required and possible.
API method void ShowHint (TRow row, string col) .
Displays cell value as Hint, only if required and possible.
API method void HideHint ( ) .
Hides the actually displayed Hint.
<C><I><cell> string Tip renamed 6.0 .
Tool tip text displayed when mouse hovers the cell.
The tip can contain HTML code except is set StandardTip=’1’.
When cell contains Error attribute, the Error string is displayed instead of the Tip.
It can be set to 1 to display cell value as tip.
<C> <cell> string TipXXX new 6.0 .
Tool tip text displayed for given cell value. The XXX is actual cell value. If such tip does not exist, the normal Tip is displayed.
It has sense especially for Bool or Button types, to show different tooltip for checked / pressed and unchecked / not pressed state.
<C> <cell> string XXXTip new 6.0 .
Tool tip text displayed for given cell event target. The XXX is actual cell event target under mouse cursor. If such tip does not exist, the normal Tip is displayed.
The XXX can be any event target name, see Actions and events, for example EditInt, ButtonSave, SideDefaults, Side, Content and so on.
It is intended to show different tool tip for part of the cell like side or tree button.
<C><I><cell> string TipClass new 6.0 .
An inner class for the tip.
It can be used to show the tip in different classes in different rows, columns or cells.
<C><I><cell> TPosition TipPosition new 6.3 .
Position of the tip dialog. By default it is placed under mouse cursor.
You can specify different Align to align it to the cell instead. For example TipPosition='{Align:"left above",Y:-4}' places the dialog above the cell.
See TPosition JSON attributes. The TipPosition automatically contains the actual cell as Tag attribute.
API event string OnTip (TGrid grid, TRow row, string col, string tip, int clientX, int clientY, int X, int Y) .
Called when tooltip is being displayed. Return new string to display or tip. Return null to not display the tip.
It is called whenever mouse doesn’t move for TipStart milliseconds. It is called only once for the mouse position.
clientX, clientY are mouse coordinates in browser window. X, Y are mouse coordinates within the cell row, col.
<Cfg> bool StandardTip [0] new 6.0 .
By default is the Tip shown as TreeGrid tooltip. Its behavior can be controlled by other attributes and events. It also supports multiline and HTML tip.
Set it to 1, to show Tip by standard browser tooltip by HTML TITLE attribute. All the other settings and events are ignored.
<Cfg> int TipStart [500] .
Time in milliseconds before tool tip is displayed while mouse is not moving.
If set to 0, the tip is never displayed, if set to 1, the tip is displayed immediately.
<Cfg> int TipEnd .
Time in milliseconds when tip will be automatically hidden. It must be higher than TipStart otherwise the tip is never shown.
If it is empty or 0, the tip never automatically hides.
API method void ShowTip (string tip) chg 6.0 .
Shows tip on actual mouse position.
API method void HideTip ( ) .
Hides the actually displayed tooltip
<C> <cell> string [*] Menu chg 6.0 .
Context (popup) menu for the cell.
This popup menu is displayed when user right clicks to cell. After user selects menu item, the OnContextMenu event is called.
It can be first character separated array of menu item names. They can contain any HTML code. Separator can be shown as item named ‘-‘
Or it can be in standard TreeGrid menu format as complex menu with sub levels, sub menus, columns and so on.
See also API ShowMenu function to show custom menu from JavaScript.
API event string OnGetMenu (TGrid grid, TRow row, string col, string menu) new 6.2 .
Called to get the popup Menu attribute dynamically by JavaScript.
menu is the original menu for the cell. It should return new menu string.
API event bool OnContextMenu (TGrid grid, TRow row, string col, string result) chg 6.0 .
Called when user clicks to context menu set by Menu attribute.
result is Value or Name of the clicked item or all value.
Return true to not close the menu.
<Actions> ShowPopupMenu ...F .
Displays pop-up Menu for the actual or focused cell
API method TMenu ShowPopup (TMenu menu, function func) new 6.2 .
Shows custom popup menu. Closes previously shown dialog or menu.
menu is string with menu items or TMenu object. func is function(TMenuItem I) called after click to the menu. The I has at least I.Name as the item name.
If no func is set, calls menu.OnSave if defined or OnContextMenu API event.
API method TMenu ShowDialog (TRow row, string col, object dialog, int leftalign, int x, int y) chg 6.0 .
Shows custom dialog for the cell. Closes previously shown dialog or menu.
The dialog can be HTML to display or TDialog object with dialog settings, see Lib Menus.
leftalign is 0 for right align and 1 for left align. x, y is position inside cell.
API method void CloseDialog ( ) upd 6.0 .
Closes actually displayed grid popup menu or dialog (Enum, Defaults, Menu, Calendar).
API variable TMenu Dialog read only chg 6.0 .
Actually displayed grid popup dialog or menu.
It is TMenu object with all settings.
API method TGrid ShowPopupGrid (TRow row, string col, string data, int width = null, int height = null) new 7.0;upd 7.1.
Creates and shows new grid as popup dialog for given cell.
width (new 7.1) is exact width of the main grid tag in pixels. If not set, the grid has set NoHScroll and uses scrollbar of the dialog
height (new 7.1) is exact height of the main grid tag in pixels. If not set, the grid has set NoVScroll and uses scrollbar of the dialog