1 Reply Latest reply on Mar 26, 2008 8:25 PM by pdpantages

    Putting oncontextmenu in datatable row tags

    pdpantages

      Hello Forum,

      I am using richfaces 3.1.4.GA

      I want to use the oncontextmenu event in rich:datatable objects.

      I took a look at the source, and found the small table in AbstractRowsRenderer.java. It looks like I can just switch the mapped event for "onRowMouseDown" to render an "oncontextmenu" instead of the normal "onmousedown".

      I understand that this would make the normal usage of onRowMouseDown unavailable, but I am willing to live with this, as I am not using it. After my one-line change, the table looks like so:

       public static final String[][] TABLE_EVENT_ATTRS = {
       {"onclick","onRowClick"},
       {"ondblclick","onRowDblClick"},
       {"onmousemove","onRowMouseMove"},
       {"onmouseup","onRowMouseUp"},
       {"oncontextmenu","onRowMouseDown"},
       {"onmouseover","onRowMouseOver"},
       {"onmouseout","onRowMouseOut"}
       };
      


      I followed the instructions from the wiki and built it. It seems to work as expected; I specify onRowMouseDown, it renders "oncontextmenu" in my table rows. The resulting context menu works properly.

      My question, is, am I going to be able to get away with this....?
      I am not at all familiar with richfaces source, but it looks to me like it should be ok. I am worried that I might cause some obscure problems (e.g., memory leaks?) or worse....

      PdP