Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a table with header row disabled breaks the content display. #2449

Open
retUrn3d opened this issue Dec 14, 2024 · 2 comments
Open
Labels
state: pending not addressed yet type: bug bug

Comments

@retUrn3d
Copy link

Version of Dear PyGui

Version: 2.0.0
Operating System: Windows 10

My Issue/Question

dpg.table() with header_row=False does not display adding new rows.

To Reproduce

  1. Create dpg.table() with header_row=False
  2. Try to add a row with any content.
  3. nothing happens :(

Expected behavior

dpg.table() with header_row=False displays the addition of new rows.

Prior to version 2.0.0, everything worked as expected.

Screenshots/Video

bad
good

Standalone, minimal, complete and verifiable example

import time
import dearpygui.dearpygui as dpg

dpg.create_context()

with dpg.window(tag='main_window'):
    with dpg.table(header_row=True, tag='test_table'):
        dpg.add_table_column(width_fixed=True)


def test():
    #  Don't judge me, I was too lazy to think.
    while True:
        dpg.render_dearpygui_frame()
        time.sleep(1)
        with dpg.table_row(parent='test_table'):
            dpg.add_text('TEST')



dpg.create_viewport(title='TEST')
dpg.set_primary_window('main_window', value=True)
dpg.setup_dearpygui()
dpg.show_viewport()
test()
dpg.start_dearpygui()
dpg.destroy_context()
@retUrn3d retUrn3d added state: pending not addressed yet type: bug bug labels Dec 14, 2024
@v-ein
Copy link
Contributor

v-ein commented Feb 3, 2025

I've just bumped into this issue as well. It is caused by a fix in 2.0 for the show flag on table columns: they can now be shown and hidden via show/hide_item just like any other widget. Unfortunately it got a side effect (in Dear ImGui) of hiding the column at render stage if it doesn't contain any contents to render. I'm going to fix that.

@v-ein
Copy link
Contributor

v-ein commented Feb 3, 2025

Technically, it's a problem in Dear ImGui, but it will be much easier and faster to fix it on DPG side. It is caused by ImGui::TableGetColumnFlags() incorrectly returning zero bits in some flags. This occurs if the table is empty on the very first frame it is rendered. The flags are internally set up by ImGui::TableUpdateLayout(), which is typically called at the start of the first row. However, an empty table does not have "the first row", which means TableUpdateLayout() only occurs in ImGui::EndTable() -- and it's too late to call TableGetColumnFlags() after that.

My assumption is that ImGui::TableGetColumnFlags() should probably invoke ImGui::TableUpdateLayout() on its own.

To fix it in DPG, I've added a check that skips flags update for the show flag if the table is empty. I'll push the fix later, when I'm done with upgrading to DPG 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet type: bug bug
Projects
None yet
Development

No branches or pull requests

2 participants