ICEfaces
  1. ICEfaces
  2. ICE-7306

second ace:menubar actionListener not firing

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1-Beta
    • Fix Version/s: 2.1-Beta2, 3.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      Tomcat 7.0.12
      ICEfaces-2.1.0.BETA-10022011-src
    • Assignee Priority:
      P1

      Description

      In the Williams application, the ace:menubar located in the second form of the page is not having the action fired. Here are the findings of the Williams developers:

      The problem is that actions on JSF page do not trigger server-side action code. The issue is caused by ace:menuBar. Here is a typical menu item Onclick function that is generated by BaseMenuRenderer:

      <a onclick="if(!OneLineApp.performAction('Submit Confirmation',this))return;showProcessingMessage('Performing Action');;ice.ace.ab({source:'sub_0:listPgFrm:j_id15',process:'@all',params:{'ice.customUpdate':'sub_0:listPgFrm:j_id15'}});" href="#" class="wijmo-wijmenu-link ui-corner-all"><span class="wijmo-wijmenu-text"><span class="wijmo-wijmenu-text">Submit Confirmation</span></span></a>

      Note the highlighted code uses the component clientId. This client id is used in ice.ace.AjaxRequest as follows:

       

      148 var form = $(ice.ace.escapeClientId(cfg.source)).parents('form:first');

      149 if(form.length == 0) {

      150 form = $('form').eq(0);

      151 }

      It tries to get the containing form of the menu item using the clientId. Unfortunately the client id is never rendered into HTML by BaseMenuRenderer. So line 148 does not return anything and ICEFaces always uses the first form as the submitting form. Our navigation menu happens to be the first form so it works. Our action menu is not the first form, so the wrong form is submitted.

      The unresponsive second ace:menubar is reproducible in the poc. Screen 1 now has a ace:menubar with 'Print' in the top right of the tabpane content. When this menuitem is clicked, a post is sent to the server but the actionListener is not executed.

        Activity

        Hide
        Brad Kroeger added a comment -

        Art made the following comment:

        I think that the 'form:first' string is a jQuery selector, not an id ( http://api.jquery.com/first-selector/ ).
        What line 148 is trying to do is just to find the containing form of the component, using jQuery calls.
        var form = $(ice.ace.escapeClientId(cfg.source)).parents('form:first');

        I think we could just use our own formOf() function instead, but before that, the menu items have to be rendered with client ids.

        Show
        Brad Kroeger added a comment - Art made the following comment: I think that the 'form:first' string is a jQuery selector, not an id ( http://api.jquery.com/first-selector/ ). What line 148 is trying to do is just to find the containing form of the component, using jQuery calls. var form = $(ice.ace.escapeClientId(cfg.source)).parents('form:first'); I think we could just use our own formOf() function instead, but before that, the menu items have to be rendered with client ids.
        Hide
        Brad Kroeger added a comment -

        Add poc changes to re-create issue - adding an ace:menubar to screen1.

        Show
        Brad Kroeger added a comment - Add poc changes to re-create issue - adding an ace:menubar to screen1.
        Hide
        Arturo Zambrano added a comment -

        This has been fixed by a preliminary generator change related to ICE-7321. The new approach will be improved, but the basic idea seems to fix this particular problem.

        Show
        Arturo Zambrano added a comment - This has been fixed by a preliminary generator change related to ICE-7321 . The new approach will be improved, but the basic idea seems to fix this particular problem.
        Hide
        Arran Mccullough added a comment - - edited

        Still seeing this issue in the latest POC code and the 1Line app code.

        To reproduce on POC:

        • Load app and add Screen 1 to first tab.
        • This should load a single menuItem in the top of the page labeled "Print"
        • Clicking on this link should have the same action as the Print Preview button.
        • Clicking on the menu doesn't have any action but clicking on the button works fine.
        Show
        Arran Mccullough added a comment - - edited Still seeing this issue in the latest POC code and the 1Line app code. To reproduce on POC: Load app and add Screen 1 to first tab. This should load a single menuItem in the top of the page labeled "Print" Clicking on this link should have the same action as the Print Preview button. Clicking on the menu doesn't have any action but clicking on the button works fine.
        Hide
        Arturo Zambrano added a comment -

        I wasn't seeing this issue before, but I committed a fix to solve the menu problems in a different way than using generic state-saving ids, and also updated the poc, and all menu issues seem to be fixed, including this one.

        Show
        Arturo Zambrano added a comment - I wasn't seeing this issue before, but I committed a fix to solve the menu problems in a different way than using generic state-saving ids, and also updated the poc, and all menu issues seem to be fixed, including this one.
        Hide
        Ken Fyten added a comment -

        This issue is still open and not working correctly in the POC.

        Show
        Ken Fyten added a comment - This issue is still open and not working correctly in the POC.
        Hide
        Arran Mccullough added a comment -

        Attaching a much more isolated test case. The page consists of two forms each with a menuBar component that displays one menuItem. Each menu is linked to a different backing bean. The second menuItem action does not get fired.

        Show
        Arran Mccullough added a comment - Attaching a much more isolated test case. The page consists of two forms each with a menuBar component that displays one menuItem. Each menu is linked to a different backing bean. The second menuItem action does not get fired.
        Hide
        Arturo Zambrano added a comment -

        this issue is now fixed by a modification in the form-lookup mechanism in ice.ace.AjaxRequest

        Show
        Arturo Zambrano added a comment - this issue is now fixed by a modification in the form-lookup mechanism in ice.ace.AjaxRequest

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Brad Kroeger
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: