Paging in tree

TreeGrid documentation

ChildPaging - download or render children on expand

In tree you can render or download children on background when their parent is being expanded at first time (or even next times).
The parent row must be collapsed to be paged. You have to set its Expanded attribute to 0.
To send all rows collapsed you can set for default row named "R": <Def><D Name='R' Expanded='0'/></Def>
The maximum of children in row is limited, because all the children are rendered at once. By default there can be 1000 children. If the count of children overruns this limit, the children are divided to newly created rows. See row's attribute MaxChildren.
An alternative to client ChildPaging are also ChildParts.
In tree you can of course use also standard paging for root rows.
upd 7.0 <Cfg> int

ChildPaging

[2]
Method of paging of children rows in tree. How will be rendered or downloaded children rows after parent is expanded for the first time.
Remember, default setting is 2 - client paging.

0No Paging
All rows, including all children are rendered on start.
This means slow start and fast use.
The rendering on scroll by ChildParts is still applicable, but limiting children count by MaxChildren is ignored.

1not applicable

2Client paging (render on expand)
Rendered on start are only children of expanded rows. Children of collapsed parent are rendered on first access.
This means faster start for collapsed tree, but slower first expanding of collapsed node.
The client paging is fully done by TreeGrid.

3Server paging (download and render on expand or on scroll)
Children of collapsed rows are downloaded on first expand. Server must be able to send the children of the row.
Since 7.0 also the children of expanded rows can be downloaded from server when they become visible due scroll.
See server paging documentation.
The server paging requires cooperation with server and you are responsible for sending children from server.
For server application you can use also TreeGrid.dll/so.
<Cfg> int

RemoveCollapsed

[0]
If rendered children are removed when parent row collapses. To speed up grid with many collapsed rows.

0None
It does not remove the children, just hides them. The next expanding is faster.

1not applicable

2Html (render on next expand will be needed)
The rows are removed from html page only and stay in data unchanged.
It can be set only for client or server ChildPaging (2 or 3).
The next expanding is as slow as the first.
It speeds up grids with many rows that were expanded and back collapsed, to not have too many HTML tags rendered.

3Data (download and render on next expand will be needed)
The rows are removed from both html and data.
It can be set only for server ChildPaging (3).
Changes in speed are the same as for value 2 (Html).
This setting can be used when children are generated dynamically to regenerate new children in every expanding.
The unsaved changes in all children are lost! Also all selection is lost.
API event void

OnRemoveCollapsed

(TGrid grid, TRow row)
Called when the row is collapsed and its children are deleted from data, only if set <Cfg RemoveCollapsed='3'/>.
new 9.3 <Cfg> int

RemoveChanged

[0]
How will behave changed rows on RemoveCollapsed or RemoveUnused.
0 - Don't remove changed rows and selected rows. If there is any such row, the removing is not done.
1 - Don't remove changed rows. If there is any such row, the removing is not done.
2 - Remove changed rows.
3 - Save changes and remove rows immediately.
4 - Save changes and wait for the server success response before removing rows.
new 9.3 API event int

OnRemoveChanged

(TGrid grid, TRow page)
Called if removing page containing some changed (or selected row for RemoveChanged==0)
For RemoveChanged==2 is called always.
Return new value for RemoveChanged to use - 1, 2, 3, 4
API event void

OnRenderPageStart

(TGrid grid, TRow row)
Called before rendering of the root page or child page started rendering.
When used child paging (<Cfg ChildPaging>), this event is fired before start of rendering children when a parent row is being expanded.
API event void

OnRenderPageFinish

(TGrid grid, TRow row)
Called after the root page or child page is fully rendered and ready.
When used child paging (<Cfg ChildPaging>), this event is fired after children are rendered when a parent row is being expanded.

MaxChildren - limit children count

Applied only when used child paging (ChildPaging>=2), (by default is ChildPaging='2').
Expanding rows with too many children can be very slow.
You can limit the maximal count of immediate children by row's attribute MaxChildren.
If the row children exceed this count, in row's children are automatically created new collapsed rows that will contain the row's children.
Since 7.0 the attributes of the creates temporary parents are read from the default row named CPage (<D Name='CPage'/>).
Sorting, filtering, grouping and calculations will still work with all the children like they were not moved.
An alternative to MaxChildren are also ChildParts.
<I> int

MaxChildren

[10000]
Maximal count of row's children. Applied only when used child paging (ChildPaging>=2).
Default value 10000 is very high and nearly disables the feature.
If the count of children exceeds this limit, in row are created sub nodes that contain parts of the children list.
This means that if MaxChildren is 1000 and row contain 3500 children, there will be created four sub nodes with 3x1000 and 1x500 children rows.
The text displayed in child page is in <Grid><Lang><Text Items='...'/></Lang></Grid>.
<I> int

MaxChildrenDiff

[20]
The children rows are grouped to sub nodes only if their count exceeds MaxChildren + MaxChildrenDiff.
To avoid creating sub nodes with 1000 + 1 node or so.
new 9.3 <I> int

MaxChildrenMin

[1]
Minimal length of the group. To avoid creating sub nodes with 1000+1000+1.
The last group with less children than the MaxChildrenMin is merged with previous group.
renamed 6.0 <Cfg> bool

MaxChildrenEmpty

[0]
Used when the count of children exceeds MaxChildren value and in row are created children pages.
If the child page row shows all values of its parent [0] or shows only value in main cell [1].

ChildParts - rendering children parts on scroll

Because standard paging is applied only on root rows, in deep tree the root page can be very long and the root paging become ineffective.
It is possible to render parts of child rows only on scroll, similarly to root paging (by default it is permitted, see ChildParts).
You should play with ChildPartLength and ChildPartMin to get the best settings for your tree - for different tree structures different settings are the best.
Remember, the child part length is applied only to immediate children, not for sub nodes, so for deep slim tree you should set ChildPartMin='0' to take the child parts its effect.
new 6.0 chg 7.0 <Cfg> int

ChildParts

[0/2]
Since version 7.0 the original and also default value 1 was changed to 2 to be compatible with other paging types (Paging, ColPaging, ChildPaging).
If set to 0, all children are rendered on expand or on start for all expanded parents.
(new 7.0) If set to 1, all children are rendered on expand or on start for all expanded parents, but with progress dialog and is possible to cancel the rendering and render it on demand.
(in 7.0 was changed from 1) If set to 2, it renders only visible (by scroll) parts of expanded children, similarly when paged root rows with all pages displayed.
On start or first expand of the children it renders only few rows (set by ChildPartMin) and next actually visible child rows renders when grid is scrolled and the part become visible.
By default it is set to 2 in grid with more than 200 children and in grids with server paging or server child paging.
new 6.0 <Cfg> int

ChildPartLength

[20]
Count of rows in one part for ChildParts. The part is rendered whenever is (at least partially) visible by scroll.
Remember, the child part length is applied only to immediate children, not for sub nodes, so for deep slim tree you should set ChildPartMin='0' to take the child parts its effect.
new 6.0 <Cfg> int

ChildPartMin

[3]
Minimal count of rows rendered immediately the parent row is expanded or rendered expanded.
It can be also 0 to not render anything immediately - it is should be set in deep slim tree.
new 7.0 <Cfg> int

MaxChildParts

[0]
Maximum rendered child parts in grid, only for ChildParts = 2.
When grid contains more rendered child parts, the child parts longer not accessed are cleared (only in HTML, data are not affected).
Used to not slow down the browser when too many HTML tags are displayed.
For large child parts you can lower this value.
The actually displayed child parts are never cleared.
Set it to 0 to disable clearing child parts.
new 9.0 <Cfg> int

RemoveUnusedPages

[2]
If set to 0, it never removes unused root pages, child pages/parts and column pages.
If set to 2, it removes unused pages due MaxPages, MaxChildParts and MaxColPages.
If set to 3, it removes also data of unused root pages or child pages.
It removes only page or child page that does not contain changed rows.
new 12.0 <Cfg> int

RemoveUnusedFixed

[3]
If the fixed left and right column sections will be removed when removing unused row pages by MaxPages or MaxChildParts.
0 - none, 1 - left, 2 - right, 3 - both
new 9.3 <Cfg> int

RemoveChanged

[0]
How will behave changed rows on RemoveCollapsed or RemoveUnused.
0 - Don't remove changed rows and selected rows. If there is any such row, the removing is not done.
1 - Don't remove changed rows. If there is any such row, the removing is not done.
2 - Remove changed rows
3 - Save changes and remove rows immediately
4 - Save changes and wait for the server success response before removing rows.
API event void

OnRenderChildPartStart

(TGrid grid, TRow row, int index)
Called before rendering of a part of children is started rendering.
The index is an index of the part from 0.
API event void

OnRenderChildPartFinish

(TGrid grid, TRow row, int index)
Called after the part of children is rendered and ready.
The index is an index of the part from 0.
new 9.0 API event void

OnRemovePage

(TGrid grid, TRow page)
Called after removing data from page or child page, when set RemoveUnusedPages = 3.
new 9.3 API event int

OnRemoveChanged

(TGrid grid, TRow page)
Called if removing page containing some changed (or selected row for RemoveChanged==0)
For RemoveChanged==2 is called always.
Return new value for RemoveChanged to use - 1, 2, 3, 4