SmartGWT LGPL version 2.4 + 2.5(2011-06-21)
Browsers: Issue occurs with Firefox 4.0.1, Chromium 14.0 while is works with IE8
Summary: Having a ListGrid with several boolean fields (checkboxes) per record, the checkbox selection is forgotten/reset to 'null' if the mouse clicking happens too fast.
The sample below shows the behaviour: Add a new record and select all checkboxes one- after the other, as fast as you can: The visual representation still shows all checkboxes selected, but internally some have been reset to 'null'. How many and which ones depends on your click speed.
Doing the same selection process slowly and then adding a new record leaves all of them enabled.
Adding a record is not changing any data in this test case, it is just a mean to show the internal data representation of the previous record to show the problem.
Can this behaviour be workarounded by any setting on the list grid or list grid field?
By the way: This is not a nonsense case, this is a real-world-case that in fact happens to many of our customers.
Browsers: Issue occurs with Firefox 4.0.1, Chromium 14.0 while is works with IE8
Summary: Having a ListGrid with several boolean fields (checkboxes) per record, the checkbox selection is forgotten/reset to 'null' if the mouse clicking happens too fast.
The sample below shows the behaviour: Add a new record and select all checkboxes one- after the other, as fast as you can: The visual representation still shows all checkboxes selected, but internally some have been reset to 'null'. How many and which ones depends on your click speed.
Doing the same selection process slowly and then adding a new record leaves all of them enabled.
Adding a record is not changing any data in this test case, it is just a mean to show the internal data representation of the previous record to show the problem.
Can this behaviour be workarounded by any setting on the list grid or list grid field?
By the way: This is not a nonsense case, this is a real-world-case that in fact happens to many of our customers.
Code:
import com.smartgwt.client.types.ListGridEditEvent; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; public class TestClass { public void onModuleLoad() { Canvas canvas = new Canvas(); final ListGrid grid = new ListGrid(); grid.setWidth(350); grid.setHeight(224); grid.setShowAllRecords(true); grid.setCanEdit(true); grid.setEditEvent(ListGridEditEvent.CLICK); grid.setModalEditing(true); int fieldCount = 6; ListGridField [] fields = new ListGridField[fieldCount]; for (int n = 0; n < fieldCount; n++) { ListGridField field = new ListGridField("b" + n, "B" + n); field.setType(ListGridFieldType.BOOLEAN); fields[n] = field; } grid.setFields(fields); IButton add = new IButton("Add new record"); add.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { ListGridRecord rec = new ListGridRecord(); grid.addData(rec); } }); add.setLeft(0); add.setTop(240); add.setWidth(140); Label label1 = new Label("Add a new record, select all checkboxes as fast as you can. All checkboxes seem to be selected. " + "Then, anytime after this, add another record. Some checkboxes of the previous record which had been selected " + "before will be unselected right now. The number of de-selected checkboxes depends on your click/selection speed. "); Label label2 = new Label("If you instead select the checkboxes of a new record slowly and after that " + "add another record, all previous checkboxes will be enabled."); Label label3 = new Label("This obviously is a timing issue. " + "Selecting the next checkbox while the previous one is not yet stored seems to reset/overwrite that value while" + " the visual representation shows the expected value."); label1.setTop(280); label1.setWidth(400); label2.setTop(340); label2.setWidth(400); label3.setTop(380); label3.setWidth(400); canvas.addChild(grid); canvas.addChild(add); canvas.addChild(label1); canvas.addChild(label2); canvas.addChild(label3); canvas.draw(); } }
Comment