1 Reply Latest reply on Feb 22, 2008 11:15 AM by Marc Sansa

    Need help with rich:componentControl in with rich:dataTable

    Marc Sansa Newbie

      I am using a usecase similar to the one described in the rich:componentControl demo and reused most of the demo code, however I am experiencing problems with the context menu. It pops up when I click on a dataTable row as expected and the value is transfered in the a4j:outputPanel specified in the code below if I click on the menu item. The problem is that after the menu is displayed and I point the mouse inside it, the menu item is not highlighted in orange as in the demo and after I clickon the menu item or move the mouse away from the menu area, the popup menu never disappears.
      Any suggestions on how to resolve this problem ?

      Thanks in advance for your help.

      Below is the subview code:

      <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%><%@taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
      <%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      <f:subview id="MySubview">

      .cur{
      cursor:pointer;
      }

      <rich:contextMenu attached="false" id="MyMenu" submitMode="ajax">
      <rich:menuItem ajaxSingle="true">
      <h:outputText escape="false"
      value="Select job # {jobId} for upload"/>
      <a4j:actionparam name="jobId"
      assignTo="#{myJobsHandler.myCurrentJobId}"
      value="{jobId}"/>
      </rich:menuItem>
      </rich:contextMenu>
      <h:panelGrid columns="1">
      <rich:spacer height="5" />
      <rich:datascroller align="center" for="myJobsDataTable" maxPages="20" />
      <rich:spacer height="5" />
      <rich:dataTable id="myJobsDataTable"
      value="#{myobsHandler.myJobsDataModel}"
      var="job"
      rows="10"
      width="100%"
      onRowMouseOver="this.style.backgroundColor='#F8F8F8'"
      onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
      rowClasses="cur">
      <rich:column width="50px">
      <f:facet name="header">
      <h:outputText escape="false" value="Job #" styleClass="informationalMsg"/>
      </f:facet>
      <h:outputText value="#{job.jobId}" styleClass="informationalMsg"/>
      </rich:column>
      <rich:componentControl event="onRowClick" for="MyMenu" operation="show">
      <f:param value="#{job.jobId}" name="jobId"/>
      </rich:componentControl>

      </rich:dataTable>

      <a4j:outputPanel ajaxRendered="true">
      <rich:panel>
      <f:facet name="header">
      <h:outputText value="Job # for File Upload" styleClass="informationalMsg"/>
      </f:facet>
      <h:outputText value="#{myJobsHandler.myCurrentJobId}"></h:outputText>
      </rich:panel>
      </a4j:outputPanel>
      </h:panelGrid>
      </f:subview>

        • 1. Re: Need help with rich:componentControl in with rich:dataTa
          Marc Sansa Newbie

          After using Firebug to troubleshoot, a javascript error was generated in a4j_3_1_4.GAorg.ajax4jsf.javascript.PrototypeScript.faces

          at line 25 as follows:

          return result;},sub:function(pattern,replacement,count){replacement=this.gsub.prepareReplacement(replacement);count=count===undefined?1:count;return this.gsub(pattern,function(match){if(--count<0)return match[0];return replacement(match);});},scan:function(pattern,iterator){this.gsub(pattern,iterator);return String(this);},truncate:function(length,truncation){length=length||30;truncation=truncation===undefined?'...':truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this);},strip:function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,'');},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,'img'),'');},extractScripts:function(){var matchAll=new RegExp(Prototype.ScriptFragment,'img');var matchOne=new RegExp(Prototype.ScriptFragment,'im');return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||['',''])[1];});},evalScripts:function(){return this.extractScripts().map(function(script){return eval(script)});},escapeHTML:function(){var self=arguments.callee;self.text.data=this;return self.div.innerHTML;},unescapeHTML:function(){var div=new Element('div');div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject('',function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):'';},toQueryParams:function(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match)return{};return match[1].split(separator||'&').inject({},function(hash,pair){if((pair=pair.split('='))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join('='):pair[0];if(value!=undefined)value=decodeURIComponent(value);if(key in hash){if(!Object.isArray(hash[key]))hash[key]=[hash[key]];hash[key].push(value);}
          26