I have a dynamicform, where i have a booleanitem i only wish to display depending on values in another field.
I have discovered, that if you set the booleanitem to not visible when you create the form, and later set it to visible, it does not get its own row in the form! Instead, it appears on the same row as the previous formitem, to the right.
I also discovered that if you set it to disabled/enabled, it pops back into place. (This is why i included the "Edit button" in the test, to show what i mean)Very strange.
I have created a simple reproducible example based on your "Grid-Form Binding - Update" example. See below. It would be great if you could investigate asap.
5.0-p20160409
I have discovered, that if you set the booleanitem to not visible when you create the form, and later set it to visible, it does not get its own row in the form! Instead, it appears on the same row as the previous formitem, to the right.
I also discovered that if you set it to disabled/enabled, it pops back into place. (This is why i included the "Edit button" in the test, to show what i mean)Very strange.
I have created a simple reproducible example based on your "Grid-Form Binding - Update" example. See below. It would be great if you could investigate asap.
5.0-p20160409
Code:
public class Test implements EntryPoint { VLayout mainLayout; BooleanItem member; TextItem name; public void onModuleLoad() { initLayout(); final ListGrid grid = new ListGrid(); grid.setWidth(500); grid.setHeight(224); grid.setShowAllRecords(true); ListGridField countryCodeField = new ListGridField("countryCode", "Code", 40); ListGridField nameField = new ListGridField("countryName", "Country"); ListGridField independenceField = new ListGridField("independence", "Nationhood", 225); independenceField.setType(ListGridFieldType.DATE); ListGridField populationField = new ListGridField("population", "Population"); populationField.setType(ListGridFieldType.INTEGER); ListGridField gdpField = new ListGridField("gdp", "GDP ($B)"); gdpField.setType(ListGridFieldType.FLOAT); grid.setFields(new ListGridField[]{countryCodeField, nameField, independenceField, populationField, gdpField}); grid.setCanResizeFields(true); grid.setData(CountrySampleData.getRecords()); name = new TextItem("countryName", "Country"); //name.setCanEdit(false); FormItem pop = new TextItem("population", "Population"); member = new BooleanItem("member_g8", "Member G8"); member.setVisible(false); //member.setCanEdit(false); final DynamicForm form = new DynamicForm(){ public void editRecord(Record record) { super.editRecord(record); } }; form.setFields(name, pop, member); grid.addRecordClickHandler(new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { form.reset(); form.editSelectedData(grid); member.setVisible(name.getValue().equals("Japan")); } }); mainLayout.addMember(grid); mainLayout.addMember(form); grid.draw(); final IButton button = new IButton(); button.setTitle("Edit"); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { if(button.getTitle().equals("Edit")){ form.editRecord(grid.getSelectedRecord()); button.setTitle("Cancel"); member.setCanEdit(true); }else{ form.cancelEditing(); button.setTitle("Edit"); member.setCanEdit(false); } } }); mainLayout.addMember(button); } public void initLayout(){ try { mainLayout = new VLayout(); //mainLayout.setAlign(VerticalAlignment.TOP); mainLayout.setMembersMargin(20); mainLayout.setBackgroundImage("bg.png"); mainLayout.setWidth(900); mainLayout.setHeight100(); HLayout centering = new HLayout(); centering.setWidth100(); centering.setHeight100(); centering.setAlign(Alignment.CENTER); centering.addMember(createEmptyFullHeightCanvas()); centering.addMember(mainLayout); centering.addMember(createEmptyFullHeightCanvas()); RootPanel.get().add(centering); centering.redraw(); } catch (Exception e) { e.printStackTrace(); } } public Canvas createEmptyFullHeightCanvas() { Canvas canvas = new Canvas(); canvas.setWidth("*"); return canvas; } }
Comment