Hi,
Setting the width on a RichTextItem after the form in which it is contained is already drawn causes it to be sized incorrectly.
Doing the same for any other type of form item does not cause any issues and the width of the item matches expectations.
Test case:
Here the form takes up the full page width, the 2 form columns together use 100% of the width, and the rich text item uses the width allocated to both columns.
This is initially sized as expected, with the item taking up the entire width of the screen.
After the item is drawn and a small delay the width of the item is set to '*' again.
Now the width of the RichTextItem appears to be wrong, it is sized to fit the control groups. If there are no controls then the width becomes 1.
Some observations:
Versions:
SmartGWT v12.1p_2023-04-01/LGPL Development Only (built 2023-04-01)
GWT 2.9.0
Tested on latest version of Chrome and Firefox.
There are no errors or warnings in the console.
Any idea what might be causing this issue?
Thank you
Setting the width on a RichTextItem after the form in which it is contained is already drawn causes it to be sized incorrectly.
Doing the same for any other type of form item does not cause any issues and the width of the item matches expectations.
Test case:
Here the form takes up the full page width, the 2 form columns together use 100% of the width, and the rich text item uses the width allocated to both columns.
This is initially sized as expected, with the item taking up the entire width of the screen.
After the item is drawn and a small delay the width of the item is set to '*' again.
Now the width of the RichTextItem appears to be wrong, it is sized to fit the control groups. If there are no controls then the width becomes 1.
Code:
@Override public void onModuleLoad() { //TextAreaItem template = new TextAreaItem("test"); RichTextItem template = new RichTextItem("test"); template.setWidth("*"); template.setHeight("*"); template.setColSpan(2); template.setShowTitle(true); template.setTitleOrientation(TitleOrientation.TOP); //template.setControlGroups(new String[0]); DataSourceField field = new DataSourceField("test", FieldType.TEXT); field.setEditorProperties(template); DataSource ds = new DataSource(); ds.setFields(field); DynamicForm form = new DynamicForm(); form.setDataSource(ds); form.setWidth100(); form.setHeight100(); form.setNumCols(2); form.setTitleWidth(150); form.setColWidths(150, "*"); form.draw(); Scheduler.get().scheduleFixedDelay(() -> { FormItem item = new FormItem("test"); form.setFields(item); for (FormItem i : form.getFields()) { i.setWidth("*"); } return false; }, 2000); }
- The issue does not occur when removing the delay and performing the form.draw() after adjusting the width, instead of before
- The issue does not occur for any other type of form item, e.g. when using the TextAreaItem the item maintains the correct width
- The issue seems to only occur if a DataSource is used
- When uncommenting the setControlGroups line it can be seen that the width (after the delay) becomes 1, making it look like the item (or at least the editing area) sizes to those control groups
- In the attached image I typed abcdefg, as can be seen in the console the item does contain that value but not all of that text is visible on the screen, looks like the editing area extends past the left edge
Versions:
SmartGWT v12.1p_2023-04-01/LGPL Development Only (built 2023-04-01)
GWT 2.9.0
Tested on latest version of Chrome and Firefox.
There are no errors or warnings in the console.
Any idea what might be causing this issue?
Thank you
Comment