[JIRA] Closed: (OFBIZ-830) Form widget header link (for sorting) doesn't render if fields have use-whens

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

[JIRA] Closed: (OFBIZ-830) Form widget header link (for sorting) doesn't render if fields have use-whens

JIRA jira@ofbiz.org
     [ http://jira.undersunconsulting.com/browse/OFBIZ-830?page=all ]
     
Marco Risaliti closed OFBIZ-830:
--------------------------------

    Resolution: Won't Fix

For the moment I will close it if someone interested on it can create a new issue.

> Form widget header link (for sorting) doesn't render if fields have use-whens
> -----------------------------------------------------------------------------
>
>          Key: OFBIZ-830
>          URL: http://jira.undersunconsulting.com/browse/OFBIZ-830
>      Project: [OFBiz] Open For Business
>         Type: Bug
>   Components: widget
>     Versions: SVN
>     Reporter: Leon Torres
>     Assignee: Jira Administrator

>
>
> Ok this is a tricky bug to describe, so I'll do this by example. Suppose you have a form "ListParties" that you re-use all over and it needs two behaviors for the "partyId" field:
> 1. Normal behavior: Show the partyId as a hyperlink to the viewParty page.
> 2. LookupParty behavior: In a LookupParty popup that uses ListParties, have the partyId hyperlink do a javascript:set_value(partyId) instead.
> This is a common scenario, where one has to re-use a field for different purposes. The form widget supports this with the use-when attribute. One way to set it up is to use the same field name="" and give them both use-whens as follows,
> <field name="partyId" header-link="sortLink" use-when="isLookup==false">
>   <hyperlink description="${partyId}" target="viewPartyLink?partyId=${partyId}"/>
> </field>
> <field name="partyId" use-when="isLookup==true">
>   <hyperlink also-hidden="false" target-type="plain" description="${partyId}"
>       target="javascript:set_value('${partyId}')"/>
> </field>
> So in a lookup form, only the second one will be used.
> The bug is that the header-link="sortLink" will not work. The sort link is not rendered in the header, preventing the user from sorting by partyId.
> However, if you swap the order of the field elements such that the header-link one is second, it will work.
> I traced this bug to ModelForm.java renderHeaderRow() where it decides how to render the header-link. The current code marked "Modification Nicolas" is not doing the right thing. It should be evaluating the use-when and comparing it to any other one before deciding to continue.
> For now the workaround is to make sure the header-link element comes after the other one.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.undersunconsulting.com/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira