Row height
TreeGrid documentation
Every row is as high as its highest cell.
Any row can have set minimal height by
Height (or global
MinRowHeight) and maximal height by
MaxHeight. Fixed and Space rows can have computed relative height to completely fill the main tag by ratio, set by
RelHeight.
Every standard (non Space) row has up to three independent sections (left, mid, right) and these sections must have the same height to not break grid layout. If cells in the row have different height, the height of the row and its sections must be updated by script (row by row). It can slow down grid, if there are many rows, so if you know the height of the highest cell, specify row
Height or global
MinRowHeight attributes.
renamed 6.0 <Cfg> int
MinRowHeight
Base minimal row height in pixels. It overrides the base row height set in CSS style by G_RowHeight class and is used if the row has not its
Height attribute set.
It specifies minimal height of standard (non space) row. But the row is always at least as high as its content - cannot overflow its content.
Set the RowHeight if most or all your rows' contents are higher than usual, to speed up row measurement. Or set it if you want to have rows higher than their content.
This height is used also in
server paging when computing height of not yet loaded page or child page, the resulted height is page.Count * grid.MinRowHeight.
new 6.0 <Cfg> int
MinSpaceRowHeight
Base minimal space row height in pixels. It overrides the base space row height set in CSS style by G_SpaceRowHeight class and is used if the row has not its
Height attribute set.
The minimal height of row is at least as high as its content. This height is without space row margin, border and padding, just height of the cell.
Set it if you want have space rows higher than their content. Be careful, in some styles setting the space row height can break down the style.
upd 6.0 <I><Space><B> int
Height
Minimal row height in pixels. Used only if its content is smaller. It is height of the row, including cell border and padding (see difference to
MaxHeight).
Set the row Height if you know the maximal height of the row content to speed up row measurement.
Or set it if you want to have the row higher than its content. The row is always as high as its highest cell or minimally as Height.
This height is used also in
client paging when computing height of not yet rendered page or child page.
Since 11.0 it can be changed by a user when set dragging edge of cell with
Resizing = 1.
upd 6.0 <I><Space> int
MaxHeight
Maximal height of row cells in pixels. By default in variable rows it affects and overflows only
multiline Type cells:
Lines,
Html,
Radio,
Img,
List, see
MaxHeightAll.
It is the height of the cell content, without cell border and padding (see difference to minimal
Height).
Since 11.0 it affects also resizing row by a user by
Resizing = 1 cell.
Setting to 0 disables the attribute usage.
It does not affect RelHeight row.
new 6.0 <C><I><cell> int
MaxEditHeight
Maximal height in pixels of multiline cell while editing.
If not set, the
MaxHeight is used.
new 6.0 <I><Space> bool
MaxHeightAll
[0/1]
If the
MaxHeight attribute is applied for all cells or for only multiline.
By default it is 0 for variable rows and 1 for fixed and space rows.
Setting to 1 for all variable rows can slightly slow down the grid rendering, because it adds one new <DIV> tag to every cell.
If set to 0, the
MaxHeight is applied only to
multiline Type cells:
Lines,
Html,
Radio,
Img,
List.
<I><Space> int
RelHeight
If set, the row height is automatically computed to fill all the remaining space in
main tag.
The height is automatically recalculated whenever the height of the main tag or its content changes.
If there are more RelHeight rows in grid, their height is computed as ratio of their RelHeight values.
The RelHeight rows together fill the remaining vertical space in main tag, so the grid has always constant height of the main tag.
Can be set only for fixed or Space rows. Ignored when set <Cfg NoVScroll or MaxVScroll or NoScroll /> attributes.
You can set row
MinHeight attribute to specify minimal height of the row. For standard (not Space) rows the MinHeight cannot be set to 0.
The result height of the RelHeight row can exceed MaxHeight bound!
<I><Space> int
MinHeight
Minimal height of
RelHeight row in pixels.
For standard (non Space) rows it cannot be lower than the row's content. If the row shows only custom HTML by LeftHtml, MidHtml and RightHtml, the minimal MinHeight value is 1.
For Space rows it can be also 0.
It has different meaning and usage than
Height attribute and is related only to
RelHeight.
Since 11.0 it affects also resizing row by a user by
Resizing = 1 cell.
new 11.0 <I> int
CanResize
[1]
If the row height can be resized by mouse dragging. Cannot be used in Space rows.
In such row there should be set also some cell with
Resizing='1' to resize the row by dragging the cell edge.
0 - no,
1 = between
MinHeight and
MaxHeight,
2 - without limits
new 11.0 <C> <cell> int
Resizing
[0/2]
If the cell checks its edges for mouse actions, bit array.
Default value is
2 for Header rows and
0 for other rows.
0 - no edge
1 - top and bottom edge for row resizing, event target is HeaderTop and HeaderBottom
2 - left and right edge for column resizing, event target is HeaderLeft and HeaderRight
3 - both vertical and horizontal edges.
new 11.0 <I> bool
Resized
[0] Uploaded to server, supports Undo
If the row height has been changed by a user.
It is uploaded to server if Upload_Type contains
Resized flag.
new 11.0 <Cfg> bool
Resizing
[1]
If row resizing is permitted.
new 12.0 <Cfg> int
UpdateHeightsTimeout
[0]
How often synchronizes row heights in column sections.
By default it is not required to synchronize row heights in the sections,
but if rows have different heights and the sections sometimes become not synchronized,
due too complex layout, set UpdateHeightsTimeout.
Value is in 200ms. 0 means never. For example value 5 means 5*200ms = every 1s.
Smaller value slows down the grid and browser, bigger value causes longer delay before the sections are synchronized.
API method int
GetRowHeight
(TRow row)
It returns height of the row in pixels. For already rendered rows returns its exact height, for not rendered rows returns its Height or MinRowHeight.
It can be called also for page and it returns height of all its rows.
API method bool
UpdateRowHeight
(TRow row, bool callUpdate)
Updates height of all row sections to be the same and also shrinks the row to its minimal possible height.
Call it to immediately correct the layout if the row content height was changed externally.
If set
callUpdate, calls
Update method after change.
Returns true if the layout is correct and false if it could not be corrected and the section still have different height - the layout is broken.
new 6.0 upd 9.0 API method bool
UpdateHeights
(int always = 0)
Immediately corrects grid layout, updates height of all sections to be the same. This method is called in interval to preserve layout break.
Call it after expected change of layout to correct the layout immediately and do not wait for the interval. This method checks first if there is some problem and if not, it returns.
It calls also
Update method if there has been any change in layout.
(new 9.0) If set
always = 1, it iterates, checks and corrects always all rows in grid. It can be very slow. Call it if the layout is still broken down even after calling UpdateHeights(0).
If set always = 2, it does the action in timeout, after actual script finishes. It can be called more times in the actual script and will be done only once.
new 11.0 API method int
OnRowResize
(TGrid grid, TRow row, int newheight, int oldheight)
Called before the
row is resized from
oldheight to
newheight, in pixels.
Return
0 to cancel action,
null to continue,
integer for new
newheight.
new 11.0 API method void
ResizeRow
(TRow row, int height)
Changes row height. Sets
Resized attribute to 0 or 1 depending on the new height is equal to original height. Calls also OnRowResize.