Below is code to create a simple ListGrid with two columns, one aligned left the other aligned right.
On page load I expected the header for the ID column to be flush to the right since it is aligned right, but there is some padding there. Clicking the button to call autoFitFields also does not work. Only when the ID column is manually resized and then the autofit button is clicked again will it show proper alignment.
Version is enterprise-12.0-p20190220
On page load I expected the header for the ID column to be flush to the right since it is aligned right, but there is some padding there. Clicking the button to call autoFitFields also does not work. Only when the ID column is manually resized and then the autofit button is clicked again will it show proper alignment.
Version is enterprise-12.0-p20190220
Code:
// In onModuleLoad VLayout layout = new VLayout(); layout.setWidth100(); layout.setHeight100(); RootPanel.get().add(layout); ListGridField idField = new ListGridField("id", "ID", 52); ListGridField nameField = new ListGridField("name", "Name", 80); idField.setAlign(Alignment.RIGHT); nameField.setAlign(Alignment.LEFT); DataSource dataSource = new DataSource(); dataSource.setClientOnly(true); dataSource.setTestData(RECORDS); DataSourceField sequenceField = new DataSourceSequenceField("id", "ID"); sequenceField.setRequired(true); DataSourceField textField = new DataSourceTextField("textField", "Text Field"); dataSource.setFields(sequenceField, textField); ListGrid listGrid = new ListGrid(dataSource); listGrid.setWidth(1200); listGrid.setHeight(800); listGrid.setCanEdit(true); listGrid.setAutoFetchData(true); listGrid.setAutoFitFieldWidths(true); listGrid.setAutoFitWidthApproach(AutoFitWidthApproach.BOTH); listGrid.setFields(idField, nameField); listGrid.setAutoFitData(Autofit.HORIZONTAL); listGrid.setAutoFitFieldsFillViewport(false); layout.addMember(listGrid); Button autofitButton = new Button("Autofit"); autofitButton.addClickHandler(h -> listGrid.autoFitFields()); layout.addMember(autofitButton);
Comment