Skip to main content

Table Functions

Full-featured replacement for old Columns API. See demo for usage examples.

BeginTable

Begin a table. Only call EndTable() if this returns true.
const char*
Unique identifier for the table
int
Number of columns
ImGuiTableFlags
default:"0"
Table flags (see ImGuiTableFlags_)
const ImVec2&
default:"ImVec2(0.0f, 0.0f)"
Outer size of table
float
default:"0.0f"
Inner width of table (for horizontal scrolling)
bool
True if table is visible and can be appended to

EndTable

End table. Only call if BeginTable() returns true.

TableNextRow

Append into the first cell of a new row.
ImGuiTableRowFlags
default:"0"
Row flags (see ImGuiTableRowFlags_)
float
default:"0.0f"
Minimum row height (includes CellPadding.y * 2.0f)

TableNextColumn

Append into the next column (or first column of next row if currently in last column). Return true when column is visible.
bool
True when column is visible

TableSetColumnIndex

Append into the specified column. Return true when column is visible.
int
Column index (0-based)
bool
True when column is visible

Table Setup

TableSetupColumn

Specify label, resizing policy, default width/weight, ID, various other flags for a column.
const char*
Column label (also used as ID unless user_id is provided)
ImGuiTableColumnFlags
default:"0"
Column flags (see ImGuiTableColumnFlags_)
float
default:"0.0f"
Initial width (for fixed columns) or weight (for stretch columns)
ImGuiID
default:"0"
Optional user ID

TableSetupScrollFreeze

Lock columns/rows so they stay visible when scrolled.
int
Number of columns to freeze
int
Number of rows to freeze

TableHeadersRow

Submit a row with headers cells based on data provided to TableSetupColumn() and submit context menu.

TableHeader

Submit one header cell manually (rarely used).
const char*
Header label

TableAngledHeadersRow

Submit a row with angled headers for every column with the ImGuiTableColumnFlags_AngledHeader flag. Must be first row.

Table Query

TableGetSortSpecs

Get latest sort specs for the table (NULL if not sorting).
ImGuiTableSortSpecs*
Sort specifications or NULL

TableGetColumnCount

Return number of columns (value passed to BeginTable()).
int
Number of columns

TableGetColumnIndex

Return current column index.
int
Current column index

TableGetRowIndex

Return current row index (header rows are accounted for).
int
Current row index

TableGetColumnName

Return column name. Pass -1 to use current column.
int
default:"-1"
Column index (-1 = current column)
const char*
Column name or empty string

TableGetColumnFlags

Return column flags. Pass -1 to use current column.
int
default:"-1"
Column index (-1 = current column)
ImGuiTableColumnFlags
Column flags

TableSetColumnEnabled

Change user accessible enabled/disabled state of a column.
int
Column index
bool
Enabled state

TableGetHoveredColumn

Return hovered column. Return -1 when table is not hovered. Return columns_count if the unused space at the right of visible columns is hovered.
int
Hovered column index or -1

TableSetBgColor

Change the color of a cell, row, or column.
ImGuiTableBgTarget
Target type (see ImGuiTableBgTarget_)
ImU32
RGBA color packed as 32-bit
int
default:"-1"
Column index (-1 = current column)
See the full tables documentation for flag descriptions and advanced examples.