Hop hop hop. In my mind, there was no change of <field use-when="...">
but a new tag.
I saw that there are many times this situation where there are two
fields and one or the other is used on the same condition. A better
solution could be a "<switch condition="..."><case
value="..."></switch>" tag perhaps.
"David E Jones" a écrit le 22/11/2006 21:09 :
This sort of thing should be discussed on the mailing list because
discussion in an issue is not threaded, so you can't respond to a
particular comment.
There are a couple of problems I see with this approach:
1. it's a pretty big change (which on its own isn't a problem...)
2. there are often more than two options, and not just a true/false;
for a single condition yes of course being a boolean it is always true
or false, but it is common to need to decide among fields to use with
different conditions, ie a combination of multiple factors and not
just a single == or != as is implied by this structure
-David
On Nov 22, 2006, at 8:10 AM, Hederer Jean-Sébastien (JIRA) wrote:
[
http://issues.apache.org/jira/browse/OFBIZ-322?page=comments#action_12451957
]
Hederer Jean-Sébastien commented on OFBIZ-322:
----------------------------------------------
This type of need could be better implemented (perhaps) with
sonething like:
<use-when condition="isLookup==false">
<true>
<field name="partyId" header-link="sortLink">
<hyperlink description="${partyId}"
target="viewPartyLink?partyId=${partyId}"/>
</field>
</true>
<false>
<field name="partyId" use-when="isLookup==true">
<hyperlink also-hidden="false" target-type="plain"
description="${partyId}"
target="javascript:set_value('${partyId}')"/>
</field>
</false>
</use-when>
It would be easier to read and maintain.
Form widget header link (for sorting) doesn't render if fields have
use-whens
-----------------------------------------------------------------------------
Key: OFBIZ-322
URL: http://issues.apache.org/jira/browse/OFBIZ-322
Project: OFBiz (The Open for Business Project)
Issue Type: Bug
Components: framework
Affects Versions: SVN trunk
Reporter: Jacques Le Roux
Assigned To: Jacques Le Roux
Priority: Minor
Fix For: SVN trunk
From Leon Torres in http://jira.undersunconsulting.com/browse/OFBIZ-830
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://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira