Hi,
I am using List Grid in my project, and was trying to auto fit the grid by using setAutoFitWidthApproach(AutoFitWidthApproach.BOTH) . I was under impression that by setting AutoFitWidthApproach.BOTH, every field would be auto-fitted to fit the field title or the data values (whichever requires more space).
In my case I have columns where the field title require more space than the data. And when I execute autoFitFields() from source code or select "Auto Fit All Columns" from the context menu in the ListGrid UI, the fields with longer header title gets auto fitted according to the data in the filed and not the header title.
Here is the sample code:
public class BuiltInDS implements EntryPoint {
private ListGrid boundList;
public void onModuleLoad(){
boundList = new ListGrid();
boundList.setWidth100();
boundList.setHeight100();
DataSource ds = DataSource.get("animals");
List<DataSourceField> gridFields = new ArrayList<DataSourceField>();
for(DataSourceField f : ds.getFields()){
f.setAttribute("wrap", true);
gridFields.add(f);
}
ds.setFields(gridFields.toArray(new DataSourceField[gridFields.size()]));
boundList.setDataSource(ds);
boundList.setAutoFetchData(true);
boundList.setAutoFitHeaderHeights(true);
boundList.setWrapCells(true);
boundList.setFixedRecordHeights(false);
boundList.setOverflow(Overflow.AUTO);
boundList.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
boundList.draw();
boundList.autoFitFields();
}
}
I am using SmartClient Version: v10.1p_2016-11-17/PowerEdition Deployment (built 2016-11-17)
I am trying to find out why AutoFitWidthApproach.BOTH is not working as expected in my grid?
Thanks!
I am using List Grid in my project, and was trying to auto fit the grid by using setAutoFitWidthApproach(AutoFitWidthApproach.BOTH) . I was under impression that by setting AutoFitWidthApproach.BOTH, every field would be auto-fitted to fit the field title or the data values (whichever requires more space).
In my case I have columns where the field title require more space than the data. And when I execute autoFitFields() from source code or select "Auto Fit All Columns" from the context menu in the ListGrid UI, the fields with longer header title gets auto fitted according to the data in the filed and not the header title.
Here is the sample code:
public class BuiltInDS implements EntryPoint {
private ListGrid boundList;
public void onModuleLoad(){
boundList = new ListGrid();
boundList.setWidth100();
boundList.setHeight100();
DataSource ds = DataSource.get("animals");
List<DataSourceField> gridFields = new ArrayList<DataSourceField>();
for(DataSourceField f : ds.getFields()){
f.setAttribute("wrap", true);
gridFields.add(f);
}
ds.setFields(gridFields.toArray(new DataSourceField[gridFields.size()]));
boundList.setDataSource(ds);
boundList.setAutoFetchData(true);
boundList.setAutoFitHeaderHeights(true);
boundList.setWrapCells(true);
boundList.setFixedRecordHeights(false);
boundList.setOverflow(Overflow.AUTO);
boundList.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH);
boundList.draw();
boundList.autoFitFields();
}
}
I am using SmartClient Version: v10.1p_2016-11-17/PowerEdition Deployment (built 2016-11-17)
I am trying to find out why AutoFitWidthApproach.BOTH is not working as expected in my grid?
Thanks!
Comment