0 Replies Latest reply on Mar 24, 2008 5:07 PM by Paul Pantages

    componentControl and oncontextmenu with rich:dataTable

    Paul Pantages Novice

      Richfaces 3.1.4.GA,JBOS 4.2.2,Seam 2.0.1.GA

      Is there a way to emulate an "onContextMenu" event for a row in rich:dataTable?
      I want to use onRowClick for something else, and I don't know how to tell if a mouseDown
      event was from the left or right button...

      I would like this to work in the same way as it does for treeNode,
      i.e., I would like to have an "onRowContextMenu" which is
      distinguished (exclusive) from "onRowClick".

      I saw the topic:
      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=126928
      which advises one to put the component control inside the columns.

      However, putting componentControl inside the rich:column does not make
      the event "oncontextmenu" work. The menu does not appear. To test, I
      tried with the "onmousedown" event, which is OK, so I am assuming that the contextMenu event is not supported.

      Here is my componentControl:

      <rich:dataTable
       rowClasses="alarmRowOdd, alarmRowEven"
       onRowClick="fselect('#{networkElement.id}', ctrlkey )"
       value="#{nodeList}"
       var="networkElement"
       rendered="true" >
      
       <c:forEach items="#{nodeRowFormats.columnDataModel}" var="column">
      
       <rich:column sortable="false"
       styleClass="#{(nodeTable.nodeSelections[networkElement.id]) ? 'selectedrow'
       : ( (column=='connectionState') ? networkElement.styleClass : 'unselectedrow' ) }" >
      
       <f:facet name="header">
       <h:outputText
       class="sortLink"
       title="#{nodeRowFormats.titleMap[column]}"
       value="#{nodeRowFormats.labelMap[column]}"
       onclick="fsort('#{column}')" />
       </f:facet>
      
       <h:outputText value="#{networkElement[column]}"/>
      
       </rich:column>
       </c:forEach>
      
       <rich:componentControl event="onRowMouseDown" for="menu" operation="show">
       <f:param value="#{networkElement.id}" name="neId"/>
       <f:param value="#{networkElement.name}" name="name"/>
       </rich:componentControl>
      
      </rich:dataTable>
      


      For the richfaces team, could you consider adding support for
      "onRowContextmenu" in a future release?