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

There may be some problems with the layout of the table #3680

Open
tmtbe opened this issue Dec 5, 2023 · 3 comments
Open

There may be some problems with the layout of the table #3680

tmtbe opened this issue Dec 5, 2023 · 3 comments
Labels
bug Something is broken

Comments

@tmtbe
Copy link

tmtbe commented Dec 5, 2023

Describe the bug

let table = TableBuilder::new(ui)
            .resizable(true)
            .cell_layout(Layout::centered_and_justified(Direction::TopDown))
            .column(Column::auto())
            .column(Column::exact(20.0))
            .column(Column::initial(200.0).range(40.0..=300.0))
            .column(Column::initial(200.0).range(40.0..=300.0))
            .column(Column::remainder())
            .min_scrolled_height(0.0);
        table.header(20.0, |mut header| {
                header.col(|ui| {
                    ui.strong("");
                });
                header.col(|ui| {
                    ui.strong("");
                });
                header.col(|ui| {
                    ui.strong("KEY");
                });
                header.col(|ui| {
                    ui.strong("VALUE");
                });
                header.col(|ui| {
                    ui.strong("DESCRIPTION");
                });
            }).body(|mut body|{
            for param in data.rest.request.params.iter_mut() {
                body.row(18.0, |mut row| {
                    row.col(|ui| {
                        ui.checkbox(&mut param.enable,"");
                    });
                    row.col(|ui| {
                        if ui.button("x").clicked(){

                        }
                    });
                    row.col(|ui| {
                        ui.text_edit_singleline(&mut param.key);
                    });
                    row.col(|ui| {
                        ui.text_edit_singleline(&mut param.value);
                    });
                    row.col(|ui| {
                        ui.text_edit_singleline(&mut param.desc);
                    });
                });
            }
            body.row(18.0, |mut row| {
                row.col(|ui| {
                    ui.checkbox(&mut self.new_param.enable,"");
                });
                row.col(|ui| {
                    if ui.button("x").clicked(){

                    }
                });
                row.col(|ui| {
                    ui.text_edit_singleline(&mut self.new_param.key);
                });
                row.col(|ui| {
                    ui.text_edit_singleline(&mut self.new_param.value);
                });
                row.col(|ui| {
                    ui.text_edit_singleline(&mut self.new_param.desc);
                });

            });
        });

Table using centered_and_justified layout will cause width and window size mismatch.

Screenshots
image

Desktop (please complete the following information):

  • OS:
@tmtbe tmtbe added the bug Something is broken label Dec 5, 2023
@tmtbe
Copy link
Author

tmtbe commented Dec 5, 2023

https://github.com/tmtbe/rust-ui.git ,You can view the code here, the specific questions are in ParamsPanel

@hacknus
Copy link
Contributor

hacknus commented Jan 5, 2025

We also ran into this issue, has there been any progress or some workarounds?

@hacknus
Copy link
Contributor

hacknus commented Jan 8, 2025

From my understanding the "available width" is calculated from the full application-window and not the egui-panel. But I don't quite get where this bug originates... anybody got an idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants