【问题标题】:right click in rich faces component右键单击丰富的面孔组件
【发布时间】:2013-03-07 08:55:00
【问题描述】:

我只需要在富面孔组件中的右键单击事件,特别是在suggestionbox

我需要在鼠标右键单击和左键单击时提供一些功能。 我认为这将通过富脸的contextMenu 来完成,但它不适用于suggestionbox

在我想传递 id 并显示模态面板的每个输出文本上(右键单击和左键单击显示不同的模型面板)。

jsf 1.2 + Richfaces 3.3

我的代码

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

【问题讨论】:

    标签: jsf richfaces jsf-1.2


    【解决方案1】:

    在丰富的面孔或任何面孔中都没有直接的方法来获取右键单击事件(contextMenu 除外)(此处不起作用)。

    只有 jquery 才能实现:

    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> 
    

    temp 变量中,我得到了建议框的表格。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-27
      • 2023-04-08
      • 2011-01-28
      • 2013-09-07
      • 1970-01-01
      • 2011-03-04
      • 2011-06-03
      • 1970-01-01
      相关资源
      最近更新 更多