Hi Team,
We are facing an issue after upgrading our application from SmartGWT 11.1 to 13.1.
In 11.1, whenever a user changed a column width through UI customization, the updated width was correctly captured in the grid’s viewState. After upgrading to 13.1, this no longer works — the column width updates are not being reflected in the viewState.
To confirm this, we created a very simple isolated test case.
In SmartGWT 11.1, the getViewState() output includes the updated column widths.
In SmartGWT 13.1, the same code does not include the updated widths — the width changes are not recorded in the viewState at all.
Attaching console logs below showing the difference in behavior between 11.1 and 13.1.
11.1 version
13.1 version
Below is the exact test class we used to reproduce the issue:
package com.i2.tm.ui.ria.client.lbp.util;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.util.SC;
public class SmartGWTWidthTestWindow {
private static Window testWindow;
private static ListGrid testGrid;
public static void show() {
if (testWindow != null && testWindow.isDrawn()) {
testWindow.bringToFront();
return;
}
createWindow();
testWindow.show();
}
private static void createWindow() {
testWindow = new Window();
testWindow.setTitle("Width Persistence Test - 4 Fields");
testWindow.setWidth(600);
testWindow.setHeight(400);
testWindow.setAutoCenter(true);
testWindow.setIsModal(true);
VLayout layout = new VLayout();
layout.setWidth100();
layout.setHeight100();
layout.setPadding(10);
// Simple 4-field grid
testGrid = new ListGrid();
testGrid.setWidth100();
testGrid.setHeight(150);
// 4 fields with initial widths
testGrid.setFields(
new ListGridField("field1", "Field 1") {{ setWidth(100); }},
new ListGridField("field2", "Field 2") {{ setWidth(120); }},
new ListGridField("field3", "Field 3") {{ setWidth(80); }},
new ListGridField("field4", "Field 4") {{ setWidth(150); }}
);
// Sample data
Record record = new Record();
record.setAttribute("field1", "Data 1");
record.setAttribute("field2", "Data 2");
record.setAttribute("field3", "Data 3");
record.setAttribute("field4", "Data 4");
testGrid.setData(new Record[]{record});
layout.addMember(testGrid);
// Test button
Button testButton = new Button("Test Width Persistence");
testButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
testWidthPersistence();
}
});
layout.addMember(testButton);
testWindow.addItem(layout);
}
private static void testWidthPersistence() {
// Get viewState BEFORE width change
String before = testGrid.getViewState();
SC.logWarn("BEFORE: " + (before != null ? before : "null"));
ListGridField[] fields = testGrid.getFields();
fields[0].setWidth(150);
fields[1].setWidth(200);
fields[2].setWidth(60);
fields[3].setWidth(100);
testGrid.setFields(fields);
// Get viewState AFTER width change
String after = testGrid.getViewState();
SC.logWarn("AFTER: " + (after != null ? after : "null"));
SC.say("Check console - ViewState should contain width info after change!");
}
}
We are facing an issue after upgrading our application from SmartGWT 11.1 to 13.1.
In 11.1, whenever a user changed a column width through UI customization, the updated width was correctly captured in the grid’s viewState. After upgrading to 13.1, this no longer works — the column width updates are not being reflected in the viewState.
To confirm this, we created a very simple isolated test case.
In SmartGWT 11.1, the getViewState() output includes the updated column widths.
In SmartGWT 13.1, the same code does not include the updated widths — the width changes are not recorded in the viewState at all.
Attaching console logs below showing the difference in behavior between 11.1 and 13.1.
11.1 version
13.1 version
package com.i2.tm.ui.ria.client.lbp.util;
import com.smartgwt.client.widgets.Window;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.util.SC;
public class SmartGWTWidthTestWindow {
private static Window testWindow;
private static ListGrid testGrid;
public static void show() {
if (testWindow != null && testWindow.isDrawn()) {
testWindow.bringToFront();
return;
}
createWindow();
testWindow.show();
}
private static void createWindow() {
testWindow = new Window();
testWindow.setTitle("Width Persistence Test - 4 Fields");
testWindow.setWidth(600);
testWindow.setHeight(400);
testWindow.setAutoCenter(true);
testWindow.setIsModal(true);
VLayout layout = new VLayout();
layout.setWidth100();
layout.setHeight100();
layout.setPadding(10);
// Simple 4-field grid
testGrid = new ListGrid();
testGrid.setWidth100();
testGrid.setHeight(150);
// 4 fields with initial widths
testGrid.setFields(
new ListGridField("field1", "Field 1") {{ setWidth(100); }},
new ListGridField("field2", "Field 2") {{ setWidth(120); }},
new ListGridField("field3", "Field 3") {{ setWidth(80); }},
new ListGridField("field4", "Field 4") {{ setWidth(150); }}
);
// Sample data
Record record = new Record();
record.setAttribute("field1", "Data 1");
record.setAttribute("field2", "Data 2");
record.setAttribute("field3", "Data 3");
record.setAttribute("field4", "Data 4");
testGrid.setData(new Record[]{record});
layout.addMember(testGrid);
// Test button
Button testButton = new Button("Test Width Persistence");
testButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
testWidthPersistence();
}
});
layout.addMember(testButton);
testWindow.addItem(layout);
}
private static void testWidthPersistence() {
// Get viewState BEFORE width change
String before = testGrid.getViewState();
SC.logWarn("BEFORE: " + (before != null ? before : "null"));
ListGridField[] fields = testGrid.getFields();
fields[0].setWidth(150);
fields[1].setWidth(200);
fields[2].setWidth(60);
fields[3].setWidth(100);
testGrid.setFields(fields);
// Get viewState AFTER width change
String after = testGrid.getViewState();
SC.logWarn("AFTER: " + (after != null ? after : "null"));
SC.say("Check console - ViewState should contain width info after change!");
}
}
Comment