I don't know if I'm misunderstanding the doc (does fetchData() cause the widget to get created?) but I have noticed the behavior where calling setGroupPadding() after fetchData() on a isGroup=true ListGrid causes the setGroupPadding() to be ignored and the default value of 10 to be used instead.
The SmartGWT version is 13.1d-20230603 but I've already observed this in a prior version 13.1d-20230522.
Just dropping a note in case if this isn't an intended behavior.
The SmartGWT version is 13.1d-20230603 but I've already observed this in a prior version 13.1d-20230522.
Just dropping a note in case if this isn't an intended behavior.
Code:
import com.google.gwt.user.client.ui.RootPanel; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.Layout; public class SmartGridWoes extends Canvas { public SmartGridWoes() { this.setBackgroundColor("#e0ffe0"); this.setHeight100(); this.setWidth100(); Layout main = new HLayout(); main.setBackgroundColor("cyan"); main.setPadding(10); main.setMembersMargin(10); ListGrid grid1 = new ListGrid(); grid1.setWidth(300); grid1.setHeight(200); main.addMember(grid1); ListGrid groupedGrid1 = new ListGrid(); groupedGrid1.setWidth(300); groupedGrid1.setHeight(200); groupedGrid1.setIsGroup(true); groupedGrid1.setGroupTitle("Grouped grid 1"); // Remove the default padding of 10, but not the margin // between the title and the grid's header. groupedGrid1.setGroupPadding(0); // Now this removes the extra header space: groupedGrid1.setLeaveGroupLabelSpace(false); main.addMember(groupedGrid1); ListGrid groupedGridFetchDataAfterPadding = new ListGrid(); groupedGridFetchDataAfterPadding.setWidth(300); groupedGridFetchDataAfterPadding.setHeight(200); groupedGridFetchDataAfterPadding.setIsGroup(true); groupedGridFetchDataAfterPadding.setGroupTitle("Fetch data after padding"); // Sets the padding to 25 as intended. groupedGridFetchDataAfterPadding.setGroupPadding(25); groupedGridFetchDataAfterPadding.fetchData(); main.addMember(groupedGridFetchDataAfterPadding); ListGrid groupedGridFetchDataBeforePadding = new ListGrid(); groupedGridFetchDataBeforePadding.setWidth(300); groupedGridFetchDataBeforePadding.setHeight(200); groupedGridFetchDataBeforePadding.setIsGroup(true); groupedGridFetchDataBeforePadding.setGroupTitle("Fetch data before padding"); // Calling fetchData() before setGroupPadding() will cause // the set padding to be ignored. groupedGridFetchDataBeforePadding.fetchData(); // refreshData() -- same thing //groupedGridFetchDataBeforePadding.refreshData(); groupedGridFetchDataBeforePadding.setGroupPadding(25); main.addMember(groupedGridFetchDataBeforePadding); addChild(main); RootPanel.get().add(this); } }
Comment