Cannot reset column width of a grid
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start at the Column.setWidth(String) method described in the issue and compare its handling of non-null and null widths with Element.removeProperty("width"). Verify that resetting with null restores the default column width, and add or update a regression test if the surrounding component tests provide an appropriate location.
Written by the indexing model from the issue text.
Description
Description of the bug
If I set the width of a column, either programmatic or by user (resizable=true) and I want programmatically to reset the width to apply defaults by calling Column.setWidth(null), the column is shown with a very large width.
If I call Column.getElement().removeProperty("width") instead , the column's width is changes to its default (as width has never been set explicitly).
The problem seems to be, that Column.setWidth(String) sets the width property to null instead of removing the property.
Instead of
public Column<T> setWidth(String width) {
getElement().setProperty("width", width);
return this;
}
it should be
public Column<T> setWidth(String width) {
if ( width != null ) {
getElement().setProperty("width", width);
} else {
getElement().removeProperty("width");
}
return this;
}
Although the workaround is easy, I think it should be fixed.
Versions
- Vaadin / Flow version: 24.5.2
- Java version: 17
- OS version: Windows
- Browser version (if applicable): Chrome
- Application Server (if applicable): Tomcat 10
- IDE (if applicable): Eclipse
- Dominant language
- Java
- Stars
- 129
- Forks
- 78
- Avg merge
- 17h 42m
- Merged PRs (30d)
- 196
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from vaadin/flow-components
-
DX Impact: Low Severity: Minor vaadin-combo-box vaadin-multi-select-combo-box
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
vaadin/flow-components#10141 · 2 comments ·
-
enhancement vaadin-upload
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vaadin/flow-components#10086 · 2 comments ·
-
documentation vaadin-ordered-layout
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vaadin/flow-components#10085 · 3 comments ·
-
documentation vaadin-text-field
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vaadin/flow-components#10062 · 3 comments ·
-
enhancement vaadin-ordered-layout
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vaadin/flow-components#9798 · 1 comment ·
All issues in vaadin/flow-components
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100