I have a big problem with the newest SmartGWT versions and I think there is a bug.
My testcase:
The datasource:
You have to have some values in the table.. There is nothing special about it.
In order to reproduce the bug:
1) Write some value to the "Name" field, e.g. "abc".
2) Click on "Add". The value is added to the table.
3) Double click on ANOTHER value of the listGrid. In my case, I double clicked on "Bob".
The value "Bob" is shown in the form and the button text updated to "Update". The form is not longer an "add" form, but an "update" form.
4) Click on the button "update". It should update the "Bob" record.
The value "abc" is shown in the form after clicking on "update" !!!!!!!
From now on, every time you click on "update", you will see "abc".
This is NOT correct!
And was not the case with earlier SmartGWT versions. I testet with the libs in my client's computer, and everything worked correctly. Unfortunately, I cannot downgrade to those old smartGWT libs because there I found another smartGWT bug, which was solved when upgrading smartGWT... so I am in a deadlock now!
Using SmartGWT 4.1p Power (SmartClient Version: v9.1p_2014-08-19/PowerEdition Deployment (built 2014-08-19).
I also tested with the latest SmartGWT Version (2014-09-03) but the bug is still there...
My testcase:
Code:
public class TestingModule implements EntryPoint { ListGrid lg = new ListGrid(); public void onModuleLoad() { final ValuesManager mainFormValuesManager = new ValuesManager(); mainFormValuesManager.setDataSource(DataSource.get("table")); mainFormValuesManager.setSaveOperationType(DSOperationType.ADD); DynamicForm singleFieldForm = new DynamicForm(); TextItem formItem = new TextItem("f_name", "Name"); singleFieldForm.setFields(formItem); singleFieldForm.setDataSource(mainFormValuesManager.getDataSource()); singleFieldForm.setValuesManager(mainFormValuesManager); mainFormValuesManager.addMember(singleFieldForm); VLayout vlayout = new VLayout(); vlayout.setHeight100(); vlayout.setWidth100(); vlayout.addMember(singleFieldForm); final IButton button = new IButton("Add"); button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (mainFormValuesManager.validate()) { mainFormValuesManager.saveData(new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { SC.say("Correctly saved"); } }); } } }); ListGrid lg = new ListGrid(); ListGridField idField = new ListGridField("f_schueler_id"); idField.setHidden(true); ListGridField nameField = new ListGridField("f_name", "Name"); lg.setFields(nameField); lg.setHeight100(); lg.setWidth100(); lg.setDataSource(DataSource.get("table")); lg.setAutoFetchData(true); lg.setSortField("f_name"); lg.addCellClickHandler(new CellClickHandler() { @Override public void onCellClick(CellClickEvent event) { ListGridRecord clicked = event.getRecord(); Integer id = clicked.getAttributeAsInt("f_schueler_id"); mainFormValuesManager .setSaveOperationType(DSOperationType.UPDATE); Criteria c = new Criteria(); c.addCriteria("f_schueler_id", id); mainFormValuesManager.fetchData(c); button.setTitle("Update"); } }); vlayout.addMember(button); vlayout.addMember(lg); vlayout.draw(); } }
Code:
<DataSource ID="table" serverType="sql" tableName="t_schueler" > <fields> <field name="f_schueler_id" type="sequence" primaryKey="true" /> <field name="f_name" type="text" required="true" /> </fields> </DataSource>
In order to reproduce the bug:
1) Write some value to the "Name" field, e.g. "abc".
2) Click on "Add". The value is added to the table.
3) Double click on ANOTHER value of the listGrid. In my case, I double clicked on "Bob".
The value "Bob" is shown in the form and the button text updated to "Update". The form is not longer an "add" form, but an "update" form.
4) Click on the button "update". It should update the "Bob" record.
The value "abc" is shown in the form after clicking on "update" !!!!!!!
From now on, every time you click on "update", you will see "abc".
This is NOT correct!
And was not the case with earlier SmartGWT versions. I testet with the libs in my client's computer, and everything worked correctly. Unfortunately, I cannot downgrade to those old smartGWT libs because there I found another smartGWT bug, which was solved when upgrading smartGWT... so I am in a deadlock now!
Using SmartGWT 4.1p Power (SmartClient Version: v9.1p_2014-08-19/PowerEdition Deployment (built 2014-08-19).
I also tested with the latest SmartGWT Version (2014-09-03) but the bug is still there...
Comment