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 bool

    Allow interaction.

  • List ListViewBase

    Controlled ListView.

  • Allow Resize bool

    Allow to change columns width.

  • Allow Reorder bool

    Allow to change columns order.

  • On Drag Update bool

    Update column width during drag, if disabled column width will be changed after the drag ended.

  • Active Region float

    Distance from border where resize allowed.

  • Drop Indicator LayoutDropIndicator

    Indicator to display new column position during column reordering.

  • Cursors Cursors

    Custom cursors to show the allowed column resize state, allowed, and denied drop states.

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);