6 Replies Latest reply on Mar 31, 2009 3:11 AM by depy

    ContextMenu - MenuItem onclick richEffect on table row

    depy

      I have table and inside every row there's a picture with rightclick contextMenu.
      Now I want to apply effect on a row/cell when the menuItem is clicked.

      Here's the code (which doesnt work for me):

      <rich:column id="col1" styleClass="#{p.status}">
       <rich:toolTip followMouse="true" rendered="#{!p.renderResolve}" direction="right">
       <span style="white-space:nowrap">
       Right click the red light to resolve this problem...
       </span>
       </rich:toolTip>
       <h:graphicImage id="imgStatus" value="resources/#{p.status}.png"/>
       <rich:contextMenu event="oncontextmenu" attachTo="imgStatus" submitMode="ajax">
       <rich:menuItem reRender="processBRMStatusTableNode2" rendered="#{!p.renderResolve}" value="Resolve" actionListener="#{processesBean.resolveBRMProcessProblem}" id="resolve">
       <f:attribute name="agentID" value="#{p.agentID}" />
       <f:attribute name="processID" value="#{p.processID}" />
       <rich:effect for="resolve" event="onclick" type="Appear" params="targetId:'col1',duration:0.8,from:0.3,to:1.0" />
       </rich:menuItem>
       <rich:menuItem reRender="processBRMStatusTableNode2" rendered="#{!p.renderEnable}" value="Enable" actionListener="#{processesBean.enableBRMProcessProblem}" id="enable">
       <f:attribute name="agentID" value="#{p.agentID}" />
       <f:attribute name="processID" value="#{p.processID}" />
       <rich:effect for="enable" event="onclick" type="Appear" params="targetId:'col1',duration:0.8,from:0.3,to:1.0" />
       </rich:menuItem>
       <rich:menuItem reRender="processBRMStatusTableNode2" rendered="#{!p.renderDisable}" value="Disable" actionListener="#{processesBean.disableBRMProcessProblem}" id="disable">
       <f:attribute name="agentID" value="#{p.agentID}" />
       <f:attribute name="processID" value="#{p.processID}" />
       <rich:effect for="disable" event="onclick" type="Appear" params="targetId:'col1',duration:0.8,from:0.3,to:1.0" />
       </rich:menuItem>
       </rich:contextMenu>
       </rich:column>
      


      When I click menuItem nothing happens.

      Any suggestions?

        • 1. Re: ContextMenu - MenuItem onclick richEffect on table row
          ilya_shaikovsky

           

          Now I want to apply effect on a row/cell when the menuItem is clicked.


          clarify please what you expect the effect should do in order to undestand what did you expect instead of
          When I click menuItem nothing happens.


          • 2. Re: ContextMenu - MenuItem onclick richEffect on table row
            depy

            I would like this: I right click the picture, the menu shows up, I click on a menu item, the cell (in which I called the menu, where the picture is) would fade from 0.3 opacity to 0.1.

            I would like this.

            • 3. Re: ContextMenu - MenuItem onclick richEffect on table row
              depy

              Ah my bad, I want the opacity to go from 0.3 to 1.0.

              • 4. Re: ContextMenu - MenuItem onclick richEffect on table row
                ilya_shaikovsky

                it seems for me that target=col1 isnt good from the beggining because the image id will be col1:imgStatus.

                • 5. Re: ContextMenu - MenuItem onclick richEffect on table row
                  depy

                  Why would be target col1:imgStatus. I want the cell to have effect not the image. Or am I getting this wrong?

                  • 6. Re: ContextMenu - MenuItem onclick richEffect on table row
                    depy

                    I've managed to do it like this:

                    <rich:column id="col1" styleClass="#{p.status}">
                    
                     <rich:toolTip followMouse="true" rendered="#{!p.renderResolve}" direction="right">
                     <span style="white-space:nowrap">
                     Right click the red light to resolve this problem...
                     </span>
                     </rich:toolTip>
                     <h:graphicImage id="imgStatus" value="resources/#{p.status}.png"/>
                     <rich:contextMenu id="contextMenuBRM1" event="oncontextmenu" attachTo="imgStatus" submitMode="ajax">
                     <rich:menuItem onclick="effect1Col1Resolve();effect2Col1Resolve();effect3Col1Resolve();effect4Col1Resolve();effect5Col1Resolve();" reRender="processBRMStatusTableNode1" rendered="#{!p.renderResolve}" value="Resolve" actionListener="#{processesBean.resolveBRMProcessProblem}" id="resolve">
                     <rich:effect name="effect1Col1Resolve" for="col1" type="Opacity" params="duration:2,from:0.8,to:0.3"/>
                     <rich:effect name="effect2Col1Resolve" for="col1" type="Opacity" params="delay:2,duration:2,from:0.3,to:0.8"/>
                     <rich:effect name="effect3Col1Resolve" for="col1" type="Opacity" params="delay:4,duration:2,from:0.8,to:0.3"/>
                     <rich:effect name="effect4Col1Resolve" for="col1" type="Opacity" params="delay:6,duration:2,from:0.3,to:0.8"/>
                     <rich:effect name="effect5Col1Resolve" for="col1" type="Opacity" params="delay:8,duration:2,from:0.8,to:0.3"/>
                     <f:attribute name="agentID" value="#{p.agentID}" />
                     <f:attribute name="processID" value="#{p.processID}" />
                     </rich:menuItem>
                     <rich:menuItem onclick="effect1Col1Enable();effect2Col1Enable();effect3Col1Enable();effect4Col1Enable();effect5Col1Enable();" reRender="processBRMStatusTableNode1" rendered="#{!p.renderEnable}" value="Enable" actionListener="#{processesBean.enableBRMProcessProblem}" id="enable">
                     <rich:effect name="effect1Col1Enable" for="col1" type="Opacity" params="duration:2,from:0.8,to:0.3"/>
                     <rich:effect name="effect2Col1Enable" for="col1" type="Opacity" params="delay:2,duration:2,from:0.3,to:0.8"/>
                     <rich:effect name="effect3Col1Enable" for="col1" type="Opacity" params="delay:4,duration:2,from:0.8,to:0.3"/>
                     <rich:effect name="effect4Col1Enable" for="col1" type="Opacity" params="delay:6,duration:2,from:0.3,to:0.8"/>
                     <rich:effect name="effect5Col1Enable" for="col1" type="Opacity" params="delay:8,duration:2,from:0.8,to:0.3"/>
                     <f:attribute name="agentID" value="#{p.agentID}" />
                     <f:attribute name="processID" value="#{p.processID}" />
                     </rich:menuItem>
                     <rich:menuItem onclick="effect1Col1Disable();effect2Col1Disable();effect3Col1Disable();effect4Col1Disable();effect1Col5Disable();" reRender="processBRMStatusTableNode1" rendered="#{!p.renderDisable}" value="Disable" actionListener="#{processesBean.disableBRMProcessProblem}" id="disable">
                     <rich:effect name="effect1Col1Disable" for="col1" type="Opacity" params="duration:2,from:0.8,to:0.3"/>
                     <rich:effect name="effect2Col1Disable" for="col1" type="Opacity" params="delay:2,duration:2,from:0.3,to:0.8"/>
                     <rich:effect name="effect3Col1Disable" for="col1" type="Opacity" params="delay:4,duration:2,from:0.8,to:0.3"/>
                     <rich:effect name="effect4Col1Disable" for="col1" type="Opacity" params="delay:6,duration:2,from:0.3,to:0.8"/>
                     <rich:effect name="effect5Col1Disable" for="col1" type="Opacity" params="delay:8,duration:2,from:0.8,to:0.3"/>
                     <f:attribute name="agentID" value="#{p.agentID}" />
                     <f:attribute name="processID" value="#{p.processID}" />
                     </rich:menuItem>
                     </rich:contextMenu>
                    
                     </rich:column>
                    


                    But the problem is, when the page refreshes using a4j:poll this table just dissapears. O_ô