Skip to content

Commit

Permalink
fix (tables): Table columns become hidden in an empty table #2449 (#2475
Browse files Browse the repository at this point in the history
)
  • Loading branch information
v-ein authored Feb 13, 2025
1 parent e11d7d1 commit f6861b3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/mvTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,17 @@ void mvTable::draw(ImDrawList* drawlist, float x, float y)

// columns
int columnnum = 0;
int last_row = ImGui::TableGetRowIndex();
for (auto& item : childslots[0])
{
ImGuiTableColumnFlags flags = ImGui::TableGetColumnFlags(columnnum);
item->state.lastFrameUpdate = GContext->frame;
item->state.visible = flags & ImGuiTableColumnFlags_IsVisible;
item->state.hovered = flags & ImGuiTableColumnFlags_IsHovered;
if (item->config.enabled)
// Note: when the table is empty, TableGetColumnFlags will incorrectly return
// zero status flags for all columns. While this is fine for `visible` and `hovered`,
// we definitely don't want to push that zero into `show`.
if (item->config.enabled && last_row >= 0)
{
// Sync the flag with the actual column state controlled by the
// user via context menu.
Expand Down

0 comments on commit f6861b3

Please sign in to comment.