[jira] [Comment Edited] (OFBIZ-10768) Cannot sort fields of a form if it has a parent

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Comment Edited] (OFBIZ-10768) Cannot sort fields of a form if it has a parent

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-10768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16737149#comment-16737149 ]

Gil Portenseigne edited comment on OFBIZ-10768 at 1/8/19 3:28 PM:
------------------------------------------------------------------

The first section set from the *parent form* the sortField name only if extend form has no config and if parent exists.

The last takes the config of the extend form... that is not the same thing ?

The middle *if* is the default value and is needed since the this.’sortFieldParameterName’ is final (cannot set it before the block).

This way is more readable :
{code:java}
if (!sortFieldParameterName.isEmpty()) {
     this.sortFieldParameterName = sortFieldParameterName;
} else {
     this.sortFieldParameterName = (parentModel != null) ? parentModel.getSortFieldParameterName() : "sortField";
}
{code}


was (Author: gil portenseigne):
The first section set from the *parent form* the sortField name only if extend form has no config and if parent exists.

The last takes the config of the extend form... that is not the same thing ?

The middle *if* is the default value and is needed since the this.’sortFieldParameterName’ is final (cannot set it before the block).

If you find a better way to write it down, that's nice :).

> Cannot sort fields of a form if it has a parent
> -----------------------------------------------
>
>                 Key: OFBIZ-10768
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10768
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>            Reporter: Taher Alkhateeb
>            Priority: Minor
>         Attachments: OFBIZ-10768.patch
>
>
> To repeat the bug:
>  * Create a form with a few fields and do not set the sort-field-parameter-name attribute
>  * Create another form that extends from this form and again do not set the sort-field-parameter-name attribute
>  * Now make any field sortable by setting sort-field="true"
>  * Observe how the link is broken. instead of having sortField=whatever in the URL, instead you would get intra-app=whatever. Thus sort field functionality becomes broken.
> After investigating this issue, I realized the reason was an error in the ModelForm.java file. I will provide a patch for a fix.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)