2013-03-07 64 views
0

只需在suggestionbox就可以在富人脸部件中特意点击右键事件。右键点击富人脸部件

我需要给一些鼠标右键单击和左键单击功能。 我认为这将与丰富的脸contextMenu完成,但它不适用于suggestionbox

在每个输出文本上,我想通过id和显示模式面板(右键单击并左键单击可显示不同的模型面板)。

JSF 1.2 + 3.3 RichFaces的

我的代码

<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> 

回答

1

丰富的面孔或任何脸部没有直接的方法来得到正确的单击事件(除了文本菜单)(未在这里工作)。

它能可能只用jQuery的:

举例suggestionbox

temp可变
<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> 

我得到的建议箱的表的TR。