PrimeFaces ContextMenu on row hover -


i trying implement contextmenu appears when mouse on row. able implement context menu on selected row, not find event hover. have write own implementation data table, or there way attach context menu hover event?

primefaces's contextmenu doesn't have option that, can use jquery that. if want show contextmenu, have change contextmenu's position mouse's position(page load contextmenu default, have css display:none, need change css). primefaces's contextmenu have widgetvar attribute use in client(it have method show show it).

my solution is: when mouse hover on row, trigger show menu, when mouse out change menu's css display:none. ex: have form(id:form),a datatable(id:cars, data area have default suffix id _data, situation data area have cars_data), contextmenu(id:xxx) (you can set mouse hover , mouse out in jquery via mouseover , mouseout)

    <h:form id="form">         <p:contextmenu id="xxx" widgetvar="men">             <p:menuitem title="zzzz" value="xxx">             </p:menuitem>         </p:contextmenu>         <style type="text/css">             .testcss{                 display: none !important;             }         </style>         <script type="text/javascript">             //<![cdata[             $(document).on('mouseover', '#form\\:cars_data', function(e) {                 $(primefaces.escapeclientid('form:xxx')).css({                     top: e.pagey+'px',                     left: e.pagex+'px'                                         }).show();             });              $(document).on('mouseout', '#form\\:cars_data', function(e) {                 $(primefaces.escapeclientid('form:xxx')).attr('style','display:none');             });              //]]>         </script>         <p:datatable id="cars"  >              ...         </p:datatable>     </h:form> 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -