[ 
https://issues.apache.org/jira/browse/OFBIZ-13315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicolas Malin updated OFBIZ-13315:
----------------------------------
    Attachment: OFBIZ-13315.patch

> Set uniqueItemName as unique on ScreenWidget
> --------------------------------------------
>
>                 Key: OFBIZ-13315
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13315
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework/widget
>            Reporter: Nicolas Malin
>            Priority: Trivial
>         Attachments: OFBIZ-13315.patch
>
>
> Recently I was face to face with a problem of non-unique name for a link menu 
> with hidden form.
> My menu was included twice in a screen hisself included on iterate-section.
> {code:xml}
>       <ws:screen name="ListElement">
>             <ws:section>
>                    <ws:iterate-section entry="element" list="elements">
>                         <ws:section>
>                             <ws:widgets>
>                                                 <ws:include-grid 
> name="ListElementFrom" 
> location="component://naccounting/widget/staticdata/NGlAccountCpd.xml"/>
>                                                 <ws:include-grid 
> name="ListElementTo" />
>                             </ws:widgets>
>                         </ws:section>
>                     </ws:iterate-section>
>             </ws:section>
>         </[code]ws:screen>
>         <wf:grid name="ListElementFrom" >
>          ....
>             <wf:field name="menuAction" title=" ">
>                 <wf:include-menu name="ListElementInLineBar"/>
>             </wf:field>
>         </wf:grid>
>         <wf:grid name="ListElementTro" >
>          ....
>             <wf:field name="menuAction" title=" ">
>                 <wf:include-menu name="ListElementInLineBar"/>
>             </wf:field>
>         </wf:grid>
>         <wm:menu name="ListElementInLineBar" >
>             <wm:menu-item name="delete" title="${uiLabelMap.CommonDelete}">
>                 <wm:link target="Element/delete">
>                         ...
>                 </wm:link>
>             </wm:menu-item>
>         </wm:menu>
>  {code}
>  
> When I clicked on delete link, I have twice the submission, each menu present.
> The reason come from the process to build a unique name use on the js script 
> to submit.
> MacroMenuRenderer.java:223 where we concat the menu name, menu item name and 
> different index present in context ('menuUniqueItemIndex', 'itemIndex' and 
> 'parentItemIndex'). It's possible if I manage different index on my screen 
> maybe I can escape my issue, but after ready and taking a step back, this 
> will be increase my screen complexity for nothing link to my problematic.
> I propose to simplify it to generate each time a real unique name that we can 
> prefix and if we need to spot an element from a custom js script I suggest to 
> use index instead name and a unique name to build correctly through multiple 
> context index. 
> Follow this way, I introduce a new class UtilRandom to centralize methods to 
> manage a unique id/name and propagate this logic on all unique item name 
> using on the screen widget engine.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to