[
http://jira.undersunconsulting.com/browse/OFBIZ-830?page=comments#action_14150 ]
Jacques Le Roux commented on OFBIZ-830:
---------------------------------------
This might go in
http://www.opensourcestrategies.com/ofbiz/ofbiz_form_widget_cookbook.txt ?
> 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