Hi Isomorphic,
I noticed following error in my application (v11.1p_2018-05-07). If a DateItem with (server) validation error is changed, it auto-triggers DynamicForm validation on the server again. This should not happen IMHO (like it does not for TextItem).
Please see this video:
BuiltInDS.java:
supplyItem.ds.xml:
Best regards
Blama
I noticed following error in my application (v11.1p_2018-05-07). If a DateItem with (server) validation error is changed, it auto-triggers DynamicForm validation on the server again. This should not happen IMHO (like it does not for TextItem).
Please see this video:
BuiltInDS.java:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.Version; 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.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; 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.form.fields.DateItem; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS extends VLayout implements EntryPoint { private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); DateItem di = new DateItem(); di.setUseTextField(true); DateItem.setDefaultProperties(di); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); setWidth100(); setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { new MyWindow().show(); } }); addMember(recreateBtn); new MyWindow().show(); draw(); } private class MyWindow extends Window { public MyWindow() { setWidth(450); setHeight(600); setTitle("Validation called too often for DateItems (onChange) (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); setShowMinimizeButton(false); setIsModal(true); setShowModalMask(true); centerInPage(); final DynamicForm df = new DynamicForm(); df.setDataSource(DataSource.get("supplyItem")); df.setInitialCriteria(new AdvancedCriteria(new Criterion("SKU", OperatorId.EQUALS, "58074602"))); df.setAutoFetchData(true); addItem(df); IButton saveBtn = new IButton("Save data", new ClickHandler() { @Override public void onClick(ClickEvent event) { df.saveData(); } }); addItem(saveBtn); IButton validateBtn = new IButton("Validate data", new ClickHandler() { @Override public void onClick(ClickEvent event) { df.validate(); } }); addItem(validateBtn); } } }
Code:
<DataSource ID="supplyItem" serverType="sql" tableName="supplyItem" titleField="itemName" testFileName="/examples/shared/ds/test_data/supplyItem.data.xml" dbImportFileName="/examples/shared/ds/test_data/supplyItemLarge.data.xml"> <fields> <field name="itemID" type="sequence" hidden="true" primaryKey="true" /> <field name="itemName" type="text" title="Item" length="128" required="true"> <validators> <validator type="serverCustom"> <serverCondition><![CDATA["$value" < "Z"]]></serverCondition> </validator> </validators> </field> <field name="SKU" type="text" title="SKU" length="10" required="true" /> <field name="description" type="text" title="Description" length="2000" /> <field name="category" type="text" title="Category" length="128" required="true" foreignKey="supplyCategory.categoryName" /> <field name="units" type="enum" title="Units" length="5"> <valueMap> <value>Roll</value> <value>Ea</value> <value>Pkt</value> <value>Set</value> <value>Tube</value> <value>Pad</value> <value>Ream</value> <value>Tin</value> <value>Bag</value> <value>Ctn</value> <value>Box</value> </valueMap> </field> <field name="unitCost" type="float" title="Unit Cost" required="true"> <validators> <validator type="floatRange" min="0" errorMessage="Please enter a valid (positive) cost" /> <validator type="floatPrecision" precision="2" errorMessage="The maximum allowed precision is 2" /> </validators> </field> <field name="inStock" type="boolean" title="In Stock" /> <field name="nextShipment" type="date" title="Next Shipment"> <validators> <validator type="serverCustom"> <serverObject lookupStyle="new" className="com.smartgwt.sample.server.listener.DateValidator" /> </validator> </validators> </field> </fields> </DataSource>
Blama
Comment