Skip to content

Prevent the number of columns to do below 12 in demo#48

Open
jccampagne wants to merge 1 commit intorerun-io:mainfrom
jccampagne:fix
Open

Prevent the number of columns to do below 12 in demo#48
jccampagne wants to merge 1 commit intorerun-io:mainfrom
jccampagne:fix

Conversation

@jccampagne
Copy link

@jccampagne jccampagne commented Feb 27, 2026

This is a quick fix for the demo as it would crash if the DragValue went below 12.

This is because the groups are hard coded as:

egui_table::HeaderRow {
    height: self.top_row_height,
    groups: vec![0..1, 1..4, 4..8, 8..12],
},

This is really a minimal fix, to prevent the demo from crashing (wasm and native).

I think it's more a bug of the demo rather than an issue with the crate, hence this quick fix rather than a more extensive-logic change in the demo...

The app crash in

egui_table::table::TableSplitScrollDelegate
fn header_ui(&mut self, ui: &mut Ui, offset: Vec2)

because groups would become stale, because of how their are calculated:

            let groups = if !header_row.groups.is_empty()
                && header_row
                    .groups
                    .iter()
                    .all(|g| g.end <= num_columns)
            {
                header_row.groups.clone()
            } else {
                (0..num_columns).map(|i| i..i + 1).collect()
            };

This is a quick fix for the demo as it would crash if the DragValue
went below 12.

This is because the groups are hard coded as:
```
egui_table::HeaderRow {
    height: self.top_row_height,
    groups: vec![0..1, 1..4, 4..8, 8..12],
},
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

index out of bounds panic when modifying table demo column count

1 participant