Author: taher
Date: Wed Jan 16 10:07:52 2019
New Revision: 1851426
URL:
http://svn.apache.org/viewvc?rev=1851426&view=revLog:
Fixed: bug in which fields of a form do not sort if it has a parent
The ModelForm.java is using an incorrect parameter name for sorting if a form
extends from another form. This fixes it by using the correct parameter name.
Thanks: Gil Portenseigne for reviewing and providing a better implementation
Modified:
ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java
Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java?rev=1851426&r1=1851425&r2=1851426&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java Wed Jan 16 10:07:52 2019
@@ -497,11 +497,11 @@ public abstract class ModelForm extends
lastOrderFields.addAll(parentModel.lastOrderFields);
}
String sortFieldParameterName = formElement.getAttribute("sort-field-parameter-name");
- if (sortFieldParameterName.isEmpty() && parentModel != null) {
- this.sortFieldParameterName = parentModel.targetType;
- } else {
- this.sortFieldParameterName = "sortField";
- }
+ if (!sortFieldParameterName.isEmpty()) {
+ this.sortFieldParameterName = sortFieldParameterName;
+ } else {
+ this.sortFieldParameterName = (parentModel != null) ? parentModel.getSortFieldParameterName() : "sortField";
+ }
String defaultRequiredFieldStyle = formElement.getAttribute("default-required-field-style");
if (defaultRequiredFieldStyle.isEmpty() && parentModel != null) {
defaultRequiredFieldStyle = parentModel.defaultRequiredFieldStyle;