SmartClient Version: v13.0p_2022-04-26/Enterprise Deployment (built 2022-04-26)
After upgrading to this new version (from 12.1) suddenly all our enum fields stopped working with the error "Not a valid option".
We traced this back to the isOneOf validator for every enum field for every datasource having a list equal to the valueMap of one of our enum fields.
The valueMap used as a list in all of the enum validators is this one, it is a field from our own Rule.ds.xml
So every formitem with an enum field suddenly has this extra isOneOf validator with completely wrong values in the list. For example here we have another enum field from a different datasource having this extra isOneOf validator causing an error.
Note: this only seems to happen once a form has been opened for our Rule.ds.xml, so opening this form somehow transforms the default isOneOf validator for enum fields.
It seems to be done in the ISC_DataBinding.js resolveFieldOrPropertyType function, I will attach a stacktrace from during debugging.
So my assumption is this overrides the default enum isOneOf validator by adding a list to it with the valueMap of our rule_oprator field but I am not sure why it is doing this.
I checked the code of the smartgwt-enterprise-13.0-p20220426.jar!/com/smartclient/public/sc/modules-debug/ISC_DataBinding.js to get a readable version
and noticed this extra validator check is new compared to older versions.
I hope you can provide some insight, for now we have made a hacky workaround in our java code by overriding the validators of our enum SelectItems during the setInitHandler.
After upgrading to this new version (from 12.1) suddenly all our enum fields stopped working with the error "Not a valid option".
We traced this back to the isOneOf validator for every enum field for every datasource having a list equal to the valueMap of one of our enum fields.
The valueMap used as a list in all of the enum validators is this one, it is a field from our own Rule.ds.xml
Code:
<field type="enum" name="rule_operator" title="" required="false" export="true" showInDetailViewer="false" allowEmptyValue="false" > <valueMap> <value ID="INCLUSIVE_BETWEEN">inclusiveBetween</value> <value ID="IS">is</value> <value ID="ONE_OF">oneOf</value> </valueMap> </field>
Note: this only seems to happen once a form has been opened for our Rule.ds.xml, so opening this form somehow transforms the default isOneOf validator for enum fields.
It seems to be done in the ISC_DataBinding.js resolveFieldOrPropertyType function, I will attach a stacktrace from during debugging.
So my assumption is this overrides the default enum isOneOf validator by adding a list to it with the valueMap of our rule_oprator field but I am not sure why it is doing this.
I checked the code of the smartgwt-enterprise-13.0-p20220426.jar!/com/smartclient/public/sc/modules-debug/ISC_DataBinding.js to get a readable version
Code:
resolveFieldOrPropertyType : function(path, ruleScope) { var details = (ruleScope ? ruleScope.getRuleContextPathDetails(path) : null), field = (details ? details.field : null), type = (field ? isc.SimpleType.getType(field.type ? field.type : "text") : null) ; // If any of the validators require a valueMap (ex. isOneOf), apply the field's // valueMap to the validator's 'list' property so it can be properly validated and // not log a warning. Although the warning doesn't affect resolving the type it // litters the log with unwanted messages. if (type && type.validators) { var validators = type.validators; for (var i = 0; i < validators.length; i++) { var validator = validators[i], validatorType = isc.Validator.getValidatorType(validator), validatorDefinition = isc.Validator.getValidatorDefinition(validatorType) ; if (validatorDefinition && validatorDefinition.valueType == "valueSet" && field.valueMap) { validator = isc.clone(validator); validator.list = field.valueMap; validators[i] = validator; } } } return type; },
I hope you can provide some insight, for now we have made a hacky workaround in our java code by overriding the validators of our enum SelectItems during the setInitHandler.
Comment