Class UnityTablePanel
A reusable, themeable data-grid MonoBehaviour: header + data rows, per-axis responsive/scrollable
layout (TableLayoutConfig), driven from an engine-free TableMatrix. Sits
beside UnityLeaderboardPanel/UnityCascadePanel in shape — a sealed, imperatively-driven
MonoBehaviour with a procedural fallback — but is the generic collaborator those (and any future
grid-shaped view) render their rows through, rather than a leaderboard-specific one.
Namespace: Serenity.Ui.Infrastructure.Views
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public sealed class UnityTablePanel : MonoBehaviour
Remarks
Attachable two ways: CreateProcedural(Transform, string) builds a fresh, unthemed root, or
gameObject.AddComponent<UnityTablePanel>() attaches to an existing themed GameObject (e.g. a
theme's authored "Rows" child). Either way, any UnityEngine.UI.VerticalLayoutGroup/
UnityEngine.UI.ContentSizeFitter already on that GameObject is disabled (never destroyed) the first time
this component configures — the table owns its own internal rows holder and never defers row stacking
to whatever layout the host GameObject carried before it became a table.
Constructors
UnityTablePanel()
Declaration
public UnityTablePanel()
Properties
ContentRect
The rect a placement/anchoring caller should target: the scroll viewport while scrolling, otherwise the plain rows holder.
Declaration
public RectTransform ContentRect { get; }
Property Value
| Type | Description |
|---|---|
| RectTransform |
IsScrolling
Whether this table has built a scroll shell (either axis has ever been scrollable).
Declaration
public bool IsScrolling { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Rows
Every built row's RectTransform, in build order — the header row first at index 0 when the matrix shows one, then every data row.
Declaration
public IReadOnlyList<RectTransform> Rows { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<RectTransform> |
Methods
CellAt(int, int)
The cell RectTransform at row/column, or null when either index is out of range.
Declaration
public RectTransform CellAt(int row, int column)
Parameters
| Type | Name | Description |
|---|---|---|
| int | row | |
| int | column |
Returns
| Type | Description |
|---|---|
| RectTransform |
Clear()
Destroys every built row and forgets the current matrix; the scroll shell (once built) is left in place.
Declaration
public void Clear()
Configure(TableLayoutConfig)
Stores config and, once a matrix has already been set at least once, rebuilds
from it under the new configuration — there is no dirty-tracking in V1, so a config change after
data has already been shown always re-runs the whole SetMatrix(TableMatrix) pipeline.
Declaration
public void Configure(TableLayoutConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| TableLayoutConfig | config |
CreateProcedural(Transform, string)
Builds a minimal, unthemed table root under parent.
Declaration
public static UnityTablePanel CreateProcedural(Transform parent, string name = "Table")
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | parent | The transform the table is parented under. |
| string | name | The built GameObject's name. |
Returns
| Type | Description |
|---|---|
| UnityTablePanel |
RefreshLayout()
Re-applies row heights and the unsized-root fallback extent without rebuilding any row — for a
caller (e.g. a placement applier) that just resized this table's own rect and needs the responsive
axis/scroll-clip extents to catch up. Replaces the leaderboard panel's old
ReassertScrollClampHeight: with the table root itself as the placement target there is no
second writer to fight, just a re-measure.
Declaration
public void RefreshLayout()
SetCellTemplate(GameObject)
Stores the themed cell label prefab (instantiated per cell), or null to build procedural TMP labels instead.
Declaration
public void SetCellTemplate(GameObject cellTemplate)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | cellTemplate |
SetMatrix(TableMatrix)
The only rebuild trigger: clears every previously built row and renders matrix from scratch under the current config.
Declaration
public void SetMatrix(TableMatrix matrix)
Parameters
| Type | Name | Description |
|---|---|---|
| TableMatrix | matrix |
SetTextStyle(UiThemeTextStyle)
Stores the theme's text style, applied to every procedural cell label the next time the matrix rebuilds.
Declaration
public void SetTextStyle(UiThemeTextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| UiThemeTextStyle | style |