1 Reply Latest reply on Sep 5, 2011 8:28 AM by Satya K

    Combining ContextMenu with ModalPanel

    Satya K Newbie

      Hi All,

       

      I have a extendedDataTable for which I attach a rich:contextMenu for copy nad delete options. When user clicks a copy menu, he should be prompted with a text field to enter new name and then the item should be saved with newly entered name.

       

      For this what I have done is : Attach contextMenu to extendedDataTable, when user selects copy menu, rich:modalPanel popsup and user enters the new name and submit the form.

       

      The problem I am facing is :

           a. If both extendedDataTable and modalPanel are in same h:form then newly entered value is not set to backingBean. But I can get what item was selected in the extendedDataTable from SimpleSelection object.

           b. If both extendedDataTable and modalPanel are in different h:form then newly entered value is set to backingBean but the selection of the extendedDataTable is not correct.

       

      I have attached the code, which I was trying to achieve above said goal .

       

      I also tried passing selected variable to modalPanel and again from then back to my bean using f:attribute, but no use

       

      (RF version 3.3.3)

       

      Please let me know if this can be achieved in any other way...

       

      Regards,

      Satya

        • 1. Re: Combining ContextMenu with ModalPanel
          Satya K Newbie

          I could not find any solution for handling this. Below approach could be helpful for anyone facing the same problem.

           

          So I had to take assistance of Javascript, here is what I have tried...

           

          Have a hidden field in the form, whenever user activates ContextMenu, the selected menu item is available at the bean side.

           

          Then when user enters a new name on modalPanel, set that value to hidden field from javascript and then submit the form.

           

          The hidden value is extraced from requestMap as below :

           



          Map<String, String> reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();


          String newTestStepName = reqMap.get("testStepSelectionForm:stepNewName");

           

           

          Regards,

          Satya