Hi Isomorphic,
Please the the following issue I stumbled into when creating a testcase for another issue.
Case 1:
Case 2:
BuiltInDS.java
employees.ds.xml (Main change: pkField hidden="true")
As you will notice the error messages are different and I think the STATUS=VALIDATION_ERROR message is correct, while the STATUS=-4 is not.
After clearValues() I'd expect the DynamicForm to behave like if it were freshly loaded.
I'm using v10.0p_2015-08-24/PowerEdition.
Best regards
Blama
Please the the following issue I stumbled into when creating a testcase for another issue.
Case 1:
- Hit Reload
- Enter Data
- Hit Save
Case 2:
- Hit Reload
- Hit Load Button
- Hit Clear Button
- Enter Data
- Hit Save
BuiltInDS.java
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.Criterion; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.OperatorId; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout vL; private TestForm tF; private HLayout hL; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); vL = new VLayout(5); vL.setTop(20); vL.setLeft(20); vL.setWidth100(); vL.setHeight100(); tF = new TestForm(); hL = new HLayout(5); IButton load1 = new IButton("Load Charles Madigen"); load1.setWidth(200); load1.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tF.fetchData(new AdvancedCriteria(new Criterion("EmployeeId", OperatorId.EQUALS, 4))); } }); IButton load2 = new IButton("Load Ralph Brogan"); load2.setWidth(200); load2.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tF.fetchData(new AdvancedCriteria(new Criterion("EmployeeId", OperatorId.EQUALS, 192))); } }); IButton clear = new IButton("Clear"); clear.setWidth(200); clear.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tF.clearValues(); } }); IButton save = new IButton("Save"); save.setWidth(200); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { tF.saveData(); } }); IButton reload = new IButton("Reload"); reload.setWidth(200); reload.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { vL.removeChild(tF); vL.markForRedraw(); tF.markForDestroy(); tF = new TestForm(); vL.addMember(tF, 0); } }); hL.addMembers(load1, load2, clear, save, reload); vL.addMembers(tF, hL); vL.draw(); } private class TestForm extends DynamicForm { public TestForm() { super(); setDataSource(DataSource.get("employees")); setAddOperation("myAdd1"); setUpdateOperation("myUpdate1"); setAutoFetchData(false); } } }
Code:
<DataSource ID="employees" serverType="sql" tableName="employeeTable" recordName="employee" testFileName="/examples/shared/ds/test_data/employees.data.xml" titleField="Name"> <fields> <field name="userOrder" title="userOrder" type="integer" canEdit="false" hidden="true" /> <field name="Name" title="Name" type="text" length="128" /> <field name="EmployeeId" title="Employee ID" type="integer" primaryKey="true" required="true" hidden="true" /> <field name="ReportsTo" title="Manager" type="integer" required="true" foreignKey="employees.EmployeeId" rootValue="1" detail="true" /> <field name="Job" title="Title" type="text" length="128" /> <field name="Email" title="Email" type="text" length="128" /> <field name="EmployeeType" title="Employee Type" type="text" length="40" /> <field name="EmployeeStatus" title="Status" type="text" length="40" /> <field name="Salary" title="Salary" type="float" /> <field name="OrgUnit" title="Org Unit" type="text" length="128" /> <field name="Gender" title="Gender" type="text" length="7"> <valueMap> <value>male</value> <value>female</value> </valueMap> </field> <field name="MaritalStatus" title="Marital Status" type="text" length="10"> <valueMap> <value>married</value> <value>single</value> </valueMap> </field> </fields> <operationBindings> <operationBinding operationType="add" operationId="myAdd1" cacheSyncOperation="myFetch1" /> <operationBinding operationType="fetch" operationId="myFetch1" outputs="EmployeeId, Name, EmployeeType"> <criteria fieldName="EmployeeId" operator="notNull" /> </operationBinding> <operationBinding operationType="update" operationId="myUpdate1" cacheSyncOperation="myFetch1" /> </operationBindings> </DataSource>
After clearValues() I'd expect the DynamicForm to behave like if it were freshly loaded.
I'm using v10.0p_2015-08-24/PowerEdition.
Best regards
Blama
Comment