Skip to content
Permalink
Browse files

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1851426 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
pythys committed Jan 16, 2019
1 parent b7132c1 commit df59ff8c72aa3106911e5552c5477d7766b76029
Showing with 5 additions and 5 deletions.
  1. +5 −5 framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelForm.java
@@ -497,11 +497,11 @@ protected ModelForm(Element formElement, String formLocation, ModelReader entity
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;

0 comments on commit df59ff8

Please sign in to comment.
You can’t perform that action at this time.