Problem solved. Tested on 12.0p 2019-04-26
Thank you.
Announcement
Collapse
No announcement yet.
X
-
The extra change notifications on the autoComplete:native fields have been fixed in builds starting on Apr 26. Note that these extra notifications were introduced with changes of Apr 18 and only apply to 12.1d.
Leave a comment:
-
Sorry for the delay responding. Using the supplied change in your test case we are able to reproduce the issue. When a solution is available we'll update you.
Leave a comment:
-
Sorry, one more thing.
I've got my custom skin modifications loaded that set autocomplete to native.
Corrected test case that shows problem on default Enterprise skin:
Code:DataSource ds = new DataSource(); ds.addField(new DataSourceFloatField("item1")); ds.addField(new DataSourceFloatField("item2")); DynamicForm form = new DynamicForm(); form.setDataSource(ds); AdvancedCriteria criteria = new AdvancedCriteria(); criteria.addCriteria("item1", OperatorId.LESS_THAN, "10"); FloatItem item1 = new FloatItem("item1"); item1.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { GWT.log("onChanged item1"); form.setValue("item2", Random.nextDouble()); } }); FloatItem item2 = new FloatItem("item2"); item2.setReadOnlyWhen(criteria); item2.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC); item2.setAutoComplete(AutoComplete.NATIVE); item2.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { GWT.log("onChanged item2 !!!!!!!!!!!!!"); } }); form.setFields( item1, item2 );
1. Form has DataSource set
2. setReadOnlyWhen is used
3. AutoComplete is set to NATIVE on field that it's value is changed by form.setValue()
Hope you can reproduce this problem now.
Best regards.
Leave a comment:
-
We are unable to reproduce the issue of the onChange handler firing for item2 in your test code as detailed. It does fire when the value is manually edited but not based on changes to item1.
Leave a comment:
-
Hi,
Warnings are gone and datasource is no longer needed but when datasource is set there is now a problem with handlers.
ChangedHandler is called on an item when form.setValue() is called but it should only be called when user change this value.
It happens when both datasource is set and setReadOnlyWhen() criteria is set.
Test case:
Code:DataSource ds = new DataSource(); ds.addField(new DataSourceFloatField("item1")); ds.addField(new DataSourceFloatField("item2")); DynamicForm form = new DynamicForm(); form.setDataSource(ds); AdvancedCriteria criteria = new AdvancedCriteria(); criteria.addCriteria("item1", OperatorId.LESS_THAN, "10"); FloatItem item1 = new FloatItem("item1"); item1.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { GWT.log("onChanged item1"); form.setValue("item2", Random.nextDouble()); } }); FloatItem item2 = new FloatItem("item2"); item2.setReadOnlyWhen(criteria); item2.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC); item2.addChangedHandler(new ChangedHandler() { @Override public void onChanged(ChangedEvent event) { GWT.log("onChanged item2"); } }); form.setFields( item1, item2 );
It's quite dangerous because can lead to infinite loops and default behavior is that
It's even stranger that in above example item2 changed handler is called twice when one digit is entered in item1.
Leave a comment:
-
Changes to address the issues you highlighted will be available in 12.0 and 12.1 builds starting April 18. The code provided will then work with or without the DataSource on the form and no call to editNewRecord is required. You shouldn't see any warnings in the logs either.
Leave a comment:
-
WARN:AutoTest:Locator with DynamicForm setReadOnlyWhen on Window
Hi,
I''ve found problems with setReadOnlyWhen() on an FormItem.
First problem is that condition is not always applied when form is showed and second my console is filled with errors like:
Code:*23:45:48.550:WARN:AutoTest:Locator string:item[0][Class="DynamicForm"] matching by index gave [DynamicForm ID:isc_DynamicForm_1]. Reliability cannot be guaranteed for matching by index if the underlying application undergoes any changes.
Code:DataSource ds = new DataSource(); ds.addField(new DataSourceTextField("type")); ds.addField(new DataSourceFloatField("discount")); DynamicForm form = new DynamicForm(); form.setDataSource(ds); AdvancedCriteria criteriaCollect = new AdvancedCriteria(); criteriaCollect.addCriteria("type", OperatorId.EQUALS, "collect"); RadioGroupItem itemType = new RadioGroupItem("type"); itemType.setValueMap("collect", "pay"); itemType.setRedrawOnChange(true); itemType.setValue("collect"); FloatItem itemDiscount = new FloatItem("discount"); itemDiscount.setDecimalPad(2); itemDiscount.setValidateOnExit(true); itemDiscount.setRequired(true); itemDiscount.setReadOnlyWhen(criteriaCollect); itemDiscount.setReadOnlyDisplay(ReadOnlyDisplayAppearance.DISABLED); form.setFields( itemType, itemDiscount ); Window window = new Window(); window.setAutoCenter(true); window.setAutoSize(true); window.addItem(form); window.show();
Code:Record r = new Record(); r.setAttribute("type", "collect"); form.editRecord(r);
Strange is that when I put this form on page (not in window) it works fine. It doesn't help to wrap form in other layouts and then into window.
So problem is probably connected with Window.
Tested on SmartGWT 12.0p 2019-04-11
Best regards
Mariusz GochTags: None
Leave a comment: