When specifying padding in ListGrid.getCellCSSText() non-text cells are displayed wrong, ie they can't be resized to show their complete contents (neither manually nor via automatic resize). The following code is based on the "Column Width" code from the Showcase and demonstrates this behaviour:
I'm using SmartGWT 3.0 and GWT 2.3
Code:
import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.AutoFitWidthApproach; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.types.VerticalAlignment; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.layout.HLayout; public class MainEntryPoint implements EntryPoint { @Override public void onModuleLoad() { final ListGrid countryGrid = new ListGrid() { @Override protected String getCellCSSText(ListGridRecord record, int row, int col) { return "padding-left: 20px; padding-right: 20px;"; } }; countryGrid.setWidth(300); countryGrid.setHeight(224); countryGrid.setShowAllRecords(true); //size field to fit either the field title or the data values in the field countryGrid.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH); countryGrid.setCanSort(false); ListGridField nameField = new ListGridField("countryName", "Country"); ListGridField areaField = new ListGridField("area", "Area"); areaField.setType(ListGridFieldType.INTEGER); ListGridField populationField = new ListGridField("population", "Population"); populationField.setType(ListGridFieldType.INTEGER); ListGridField independenceField = new ListGridField("independence", "Independence"); independenceField.setType(ListGridFieldType.DATE); countryGrid.setFields(nameField, areaField, populationField, independenceField); countryGrid.setData(CountryData.getRecords()); countryGrid.setLayoutAlign(VerticalAlignment.CENTER); HLayout l = new HLayout(); l.setWidth100(); l.setHeight("50%"); l.setAlign(Alignment.CENTER); l.addMember(countryGrid); l.draw(); } }