Table Header
Used with ListView on table mode. Allows to resize and reorder columns.
Important
TableHeader and the ListView.DefaultItem should have same amout of the children GameObjects (cells count should match with header cells count).
Options
Interactable
boolAllow interaction.
List
ListViewBaseControlled ListView.
Allow Resize
boolAllow to change columns width.
Allow Reorder
boolAllow to change columns order.
On Drag Update
boolUpdate column width during drag, if disabled column width will be changed after the drag ended.
Active Region
floatDistance from border where resize allowed.
Cursors
CursorsCustom cursors to show the allowed column resize state, allowed, and denied drop states.
FillContextMenu
boolFill ContextMenu. Requires the
ContextMenucomponent.ContextMenuNames
List<string>Names for the ContextMenu items. They should be in the same order as columns.
Drop Indicator
LayoutDropIndicatorIndicator to display new column position during column reordering.
Drag Button
PointerEventData.InputButtonThe button that should be pressed to process the drag event.
Cet Current Columns Order
// index is the original position of the column
// value is the current position of the column
var order = tableHeader.GetColumnsOrder();
Change Columns Order
var order = new List<int>(2, 1, 0);
tableHeader.SetColumnsOrder(order);
Restore Original Columns Order
tableHeader.RestoreColumnsOrder();
Disable Column
var column = 0;
tableHeader.ColumnDisable(column);
Enable Column
var column = 0;
tableHeader.ColumnEnable(column);
Add/Remove Column at Runtime
var order = tableHeader.GetColumnsOrder();
tableHeader.RestoreColumnsOrder();
// add new column to the header
new_column_header.SetParent(tableHeader.transform);
new_column_header.SetSiblingIndex(...);
order.Insert(..., ...);
// or remove column
Destroy(tableHeader.transform.GetChild(index));
order.RemoveAt(...);
tableHeader.Refresh()
// new DefaultItem with another set of cells
listView.DefaultItem = newDefaultItem;
// modify order with new column index or deleted column index and set it back
tableHeader.SetColumnsOrder(order);