Jubin Patel
Jubin Patel

Reputation: 2052

right click in rich faces component

simply i need right click event in rich faces component specially in suggestionbox.

i need to give some functionality on mouse right click and also on left click. I think it will be done with rich face's contextMenu but it not works in suggestionbox.

on every outputtext i want to pass id and show modal panel(right click and left click have different model panel to display).

jsf 1.2 + richfaces 3.3

my code

<h:inputText id="templateName"  style="text-align:left" size="45"
                    value="#{templateMaintenanceBean.templateName}"
                    onblur="upperCase(this)" >

                <sc:suggestionbox height="200" width="300" id="properySuggestBox" for="templateName"  
                    oncomplete="testFunction();" nothingLabel="No Template Found" reRender="selectedMedicationDiv"
                    suggestionAction="#{templateMaintenanceBean.autocomplete}" var="result" border="2" minChars="0"
                     immediate="true" shadowDepth="10"   >

                    <h:column>  
                          <h:outputText value="#{result.templateName}" id="temp" /> 

                    </h:column>


                </sc:suggestionbox>

Upvotes: 0

Views: 1114

Answers (1)

Jubin Patel
Jubin Patel

Reputation: 2052

in rich faces or in any faces no direct way to get right click event(except contextMenu)(which is not working here).

it can possible with only jquery :

Example for suggestionbox:

<script type="text/javascript">

        jQuery.noConflict();
        jQuery(document).ready(function($){

        var temp = $('#templateListForm\\:properySuggestBox div div table tbody tr td div table tbody tr td');

        temp.live('contextmenu', function(ev){
            ev.preventDefault();
            //alert("Value:::"+$(this).parent().index('tr'));   
            //alert($(this).text());
          if(ev.which == 3)
          {
             var templateName = $(this).text();

        //    handle Events(Link any button click) which we have to perform 

          }

            });  
        });

    </script> 

in temp variable i get the suggestion box's table's tr.

Upvotes: 1

Related Questions