Text, Lines and Pass types
TreeGrid documentation
The
Text and
Lines types are basic cell types to display editable texts.
They cannot contains HTML tags to display - the < and & characters are automatically escaped.
Text type
Text type is default cell type and shows a text in the cell in one line.
It is edited in <input> tag.
When it is longer than cell width, it is
not wrapped to more lines, but it is overflowed.
It is
not possible to set or input CR/LF (Enter) characters into the text.
Lines type
Lines type shows a text in the cell in one or
more lines.
It is edited in <textarea> tag.
It is automatically wrapped if the text is longer than cell width, but only if it contains white spaces or other characters to wrap on.
It is possible enter CR/LF (Enter) characters into the text if set
AcceptEnters='1'.
To put CR/LF into XML into cell value, use
XML entity.
Pass type
Special type without any formatting to input password.
It does
not show the entered value.
To server are passwords sent not coded!
<C> <cell> string
Type
["Text"] Type="Text" or "Lines"
To define Text type, set column or cell attribute Type to "
Text", for Lines type set Type to "
Lines".
upd 11.0 <Cfg><C><cell> int
AcceptEnters
[0]
How the Enter key will be handled in
Lines type and optionally in other type cells. Bit array.
For
0 the Enter key accepts changes and finishes editing.
For
1 the Enter key inputs LF character (
). To finish editing is possible by Ctrl / Alt / Shift + Enter or Tab or click outside the cell.
For
2 (new 11.0) the Ctrl / Alt / Shift + Enter key inputs LF character (
). To finish editing is possible by Enter or Tab or click outside the cell.
For
3 (new 11.0) the Enter and Ctrl / Alt / Shift + Enter key inputs LF character (
). To finish editing is possible by Tab or click outside the cell.
For
4,
5,
6,
7 (new 11.0) is the same as 0, 1, 2, 3, but it is used also for other types than Lines. If the entered value contains LF, the cell Type is set to Lines.
new 6.0 <C> <cell> string
EmptyValue
[""]
The string displayed when the text empty.
It is shown only for display, not for edit.
It is
not escaped, it can contain HTML code.
chg 9.2 <C> <cell> string
Format
Specifies text format - how the text will be modified for display.
Since 9.2 it can be JSON named array of display values for particular cell values. Format must start by '
{'. All other cell values are displayed unchanged. The items can contain HTML code. The names are case sensitive.
For example if
<C Type="Text" Format = '{One:"Red", Two:"Green", Three:"<b>blue</b>"}'/> and the cell value is Two, it displays Green, if the cell value is Four, it displays Four.
JSON Format + EditFormat can be used to define name / key pairs for Text and Lines type, especially when used Suggest or Defaults dialog.
Syntax: |LetterType|Prefix|Postfix|Search|Flags|Replace
'|' is any character not contained in any section to separate section values. Remember, it must be the first character in the format.
'LetterType' is number specifies case conversion: 0 - none, 1 - lowercase, 2 - uppercase, 3 - locale lowercase, 4 - locale uppercase
'Prefix' is string added before value
'Postfix' is string added after value
'Search' is RegExp string to replace it for 'Replace' string. This runs before LetterType conversion. 'Flags' are flags for RegExp, any of 'g', 'i', 'm'.
Since 6.4 the Replace string is not escaped when NoFormatEscape='1'.
In
Prefix and
Postix is
not possible to use HTML tags except
NoFormarEscape is set. To format the value by HTML tags rather use cell attributes
HtmlPrefix and
HtmlPostfix instead.
Remember, the Format is applied also when sorting, grouping, filtering or searching.
new 9.2 chg 10.0 <C> <cell> string
EditFormat
Specifies format for editing - how the text will be modified for edit and the edited value back to data.
JSON named array of input values for particular cell values. Format must start by '
{'. All other cell values are edited unchanged. The items must not contain HTML code. The names are case sensitive.
For example if
<C Type="Text" EditFormat = '{1:"one", 2:"two", 3:"three"}'/> and cell has value 2, the value for input will be two. If entered 'three', the cell value will be 3, if entered 'four', the cell value will be 'four'.
Since 10.0 it is compared case insensitive.
new 10.0 <C> <cell> string[ ]
EditFormatType
Various settings for the EditFormat. Comma separated list of keywords, case insensitive.
Case - if set, preserves case sensitivity, shows only items that contains the text in the same case.
WhiteChars - uses
WhiteChars cell attribute value for comparing.
CharCodes - uses
CharCodes cell attribute value for comparing.
chg 12.1 <Cfg> bool
NoFormatEscape
[""]
If set to "" (default), it means
0 for text and
1 for lines, number and date.
If set to
0, the Format
Prefix and
Postfix is escaped, so the characters & and < are displayed as they are.
If set to
1, you can use HTML tags in columns
Format string, in prefix and postfix for text and anywhere for numbers.
Since 12.1 it is applied also for Lines type.
new 7.0 <C> int
VarHeight
[0]
Set to columns containing wrap able cells, to shrink row height when the column is resized by a user and cells values occupy less height.
For
1 the rows are resized after column resizing finishes.
For
2 it resizes the rows during column resizing, it can be slow and should be used only for small grids.