TreeGrid v6.0
Cell spanning
Cells in TreeGrid can be spanned horizontally among columns, vertically among rows or in both directions together.
It is even possible to cross vertical and horizontal span, except:
if row span starts from (next) cell already hidden by col span, the row span is ignored.
if col span starts from (next) cell already hidden by row span, the col span is ignored.
Cells cannot be spanned between column sections (Left, Mid, Right).
It is possible to drag column into spanned range, the dropped column will get the span setting from the range.
It is possible to drag column outside spanned range, the dropped column will loose its col span and the cells become displayed.
It is possible to drag column inside the spanned range.
If you permit column moving between spanned columns, you should forbid saving the changes to cookies by <Cfg ColsPosLap=’1’/>.
If grid contains any spanned cells between columns (<I Spanned=’1’/>), the column moving is done by re-rendering whole grid.
<I> bool Spanned [0] .
If the row contains any horizontally spanned cells among columns (marked with Span attribute).
Every row that contains some spanned or merged cells among columns must have set Spanned=”1”, otherwise the cell Span, Merge or MergeEdit attributes will be ignored.
<I cell> int Span [0] upd 6.0 .
The name is not ColSpan, but Span only!
For horizontally spanned cell among columns, how many cells it covers, at least one. Including hidden columns.
The row with spanned cell must have set Spanned=’1’, otherwise the attribute is ignored.
In the whole spanned cell is shown value of this column. It can be changed by Merge and MergeStart attributes.
<I cell> string[] Merge chg 6.0 .
To show more or other values in one cell. A comma separated list of column names to show in the cell.
The row with merged cell must have set Spanned=’1’, otherwise the attribute is ignored.
The cell will show values from all the row cells from the columns listed. The way of showing is specified by MergeFormat and MergeType.
The attribute is intended to show more values in spanned cell, but can be used also for display other or more values in any cell.
This attribute is ignored in export to Excel.
<I cell> string MergeFormat new 6.4 .
If set, it specifies full HTML for display the merged values. The column names are replaced by the cell values.
If not set, the cell values are merged in <table> according to the 1. bit of MergeType.
For example “Path/Name.Ext” can be used for file path, where Path, Name and Ext are column names.
<I cell> string MergeFormatXXX new 6.4 .
Special MergeFormats used for particular Merge columns combination when some of the cells are empty.
Can be used to better specify what will be excluded from format instead of MergeType=’4’.
The XXX are column names that are not empty for this row in the same order as in Merge.
For example for Merge=’Path/Name.Ext’ can be MergeFormatNameExt used when Path is empty.
<I cell> string MergeFormatEmpty new 6.4 .
MergeFormat use when all merged cells are empty
<I cell> string MergeEditFormat new 6.4 .
MergeFormat used for editing. Set it especially when MergeFormat contains HTML code. If not set, the MergeFormat is used instead.
<I cell> string MergeEditFormatXXX new 6.4 .
Special MergeEditFormats used for particular Merge columns combination when some of the cells are empty.
Can be used to better specify what will be excluded from format instead of MergeType=’4’.
The XXX are column names that are not empty for this row in the same order as in Merge.
For example for Merge=’Path/Name.Ext’ can be MergeEditFormatNameExt used when Path is empty.
<I cell> string MergeEditFormatEmpty new 6.4 .
MergeEditFormat use when all merged cells are empty
API event void OnMergeChanged (TGrid grid, TRow row, string col, string val, string[] result) new 6.4 .
Called after the cell with MergeFormat is edited. The val is the edited string, the result is default parsed val into array of cell values.
The order in result is the same as in Merge.
Fill the result with new values if the value needs special parsing. Remember, the result has already filled its items.
For example, to parse file path in order Path, Name, Ext use such handler:
Grids.OnMergeChanged = function(G,row,col,val,res){
var idx = val.lastIndexOf("/");
if(idx>=0){ res[0] = val.slice(0,idx); val = val.slice(idx+1); } else res[0] = "";
var idx = val.lastIndexOf(".");
if(idx>=0) { res[1] = val.slice(0,idx); res[2] = val.slice(idx+1); } else { res[1] = val; res[2] = ""; }
}
<I cell> string MergeEdit chg 6.0 .
Used only without MergeFormat set. Specifies the one cell value that can be edited in merged cell. Only one value in merged cell can be edited without MergeFormat.
It is a column name. This column should be listed in Merge array.
The row with merged cell must have set Spanned=’1’, otherwise the attribute is ignored.
<I cell> int MergeType [0] upd 6.4.
Various flags for merging cells, bit array.
1. bit (&1) 0 – (only without MergeFormat) merged cells are displayed in one line (horizontally), 1 – merged cells are displayed in more lines (vertically)
2. bit (&2) 0 – if column is hidden, its cell value is removed too, 1 – all merged cell values are always visible regardless of column visibility. See FastMerge.
3. bit (&4) 1 – (only for MergeFormat) remove separated part after empty value (for the last column before empty value).
<Cfg> bool FastMerge [1] new 6.0 .
If set to 1, ignores MergeType&2 (takes it as 1) for all cells when showing / hiding column.
It is faster, because the merged cells does need to be refreshed.
<I> bool SortSpan [0] .
Controls sorting in Spanned row.
By default, the grid sorts spanned rows always according to value in sorted column, even if this is invisible due spanning.
You can set values in these columns for spanned rows to support sorting in the way you want.
Or you can set SortSpan = ‘1’ and row will be sorted always according to spanned column’s value.
<I> string LeftHtml new 6.0 .
You can span the whole left column section and show here any HTML code.
All cell values in the section will be ignored.
<I> string MidHtml new 6.0 .
You can span the whole variable column section and show here any HTML code.
All cell values in the section will be ignored.
<I> string RightHtml new 6.0 .
You can span the whole right column section and show here any HTML code.
All cell values in the section will be ignored.
<Cfg> bool SpannedTree [0] new 6.0 .
Set to 1 if some MainCol cell is spanned between columns (has set Span attribute).
If set to 1, it shows tree icons in included <table> tag and slows down rendering.
<C> int Group [0] .
Controls moving column, it is useful especially if there are some cells spanned to or from other columns.
If set to > 0, it is the group the column belongs to. Create groups that contain the spanned cells. The groups must be continuous.
The columns can be moved only inside its group and any other column cannot be moved into the group from outside.
The first (left) column in the group cannot be moved within group and also must stay the first.
The whole group can be moved by dragging the first left column to another location.
This attribute has no relation with grouping rows.
In tree are all rows’ children spanned according to its parent row.
Spanning rows is not compatible with grouping, or you must ensure that no spanned cells will be broken by grouping!
If grid contains some spanned rows, filter always re-renders whole grid.
Cells are never spanned vertically among pages, the created page is always as high as to accommodate all spanned rows. In server paging you must ensure it by yourself.
Spanned rows are sorted together, their position within spanned range is always preserved.
It is possible to drag row into spanned range, the dropped row will get the span setting from the range.
It is possible to drag row outside spanned range, the dropped row will loose its row span and the cells become displayed.
It is possible to drag whole spanned range by dragging the first row in range
It is possible to drag row inside the spanned range, only the first row (with RowSpan set) will stay always the first row in the range.
<C> bool Spanned [0] new 6.0 .
If the column contains any vertically spanned cells among rows (marked with RowSpan attribute).
Every column that contains some spanned cells among rows must have set Spanned=”1”, otherwise the cell RowSpan attribute will be ignored.
<I cell> int RowSpan [0] new 6.0 .
For vertically spanned cell among rows, how many cells it covers, at least one. Including hidden rows.
In tree it is a count of rows on the same level as this row. All their children are spanned automatically.
The column with spanned cell must have set Spanned=’1’, otherwise the attribute is ignored.
.