11 Replies Latest reply on Sep 13, 2007 11:59 AM by Ilya Shaikovsky

    suggestionbox inside dataTable

    thierry baudouin Newbie

      hello,

      i already messages in this forum about suggestionbox and dataTable.

      My problem is thay when i tape letters in my input forum, no list appear in window.

      i added this code in xhtml file :
      <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender"/>

      my environement is:
      jboss4.0.4
      jdk 1.5
      jsf 1.1(myfaces impl)

      why the data list don't appear ?
      do i have to migrate in jsf 1.2 ? (with sun ri 1.2 or myfaces 1.2 ?)

      thanks
      *********

      <h:form>

      <rich:dataTable
      onRowMouseOver="this.style.backgroundColor='#F8F8F8'"
      onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
      var="perfjoueur" value="#{SaisieIndivBean.performancesjoueurs}">


      <h:column>

      <h:inputText styleClass="top_tab" value="#{perfjoueur.playername}" id="joueur" />
      <rich:suggestionbox for="joueur" tokens=",["
      rules="#{SuggestionBox.rules}"
      suggestionAction="#{SuggestionBox.autocomplete}" var="result"
      fetchValue="#{result.text}" rows="#{SuggestionBox.intRows}"
      first="#{SuggestionBox.intFirst}"
      minChars="#{SuggestionBox.minchars}"
      shadowOpacity="#{SuggestionBox.shadowOpacity}"
      border="#{SuggestionBox.border}" width="#{SuggestionBox.width}"
      height="#{SuggestionBox.height}"
      shadowDepth="#{SuggestionBox.shadowDepth}"
      cellpadding="#{SuggestionBox.cellpadding}">
      <h:column>
      <h:outputText value="#{result.text}" />
      </h:column>
      <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender"/>
      </rich:suggestionbox>
      <f:facet name="footer">TOTAL</f:facet>
      </h:column>

      <h:column>
      <h:inputText styleClass="top_tab" value="#{perfjoueur.victoires}"/>

      </h:column>

      <h:column>
      <h:inputText styleClass="top_tab" value="#{perfjoueur.defaites}"/>

      </h:column>

      </rich:dataTable>
      <h:commandButton action="save" value="VALIDER" />

      </h:form>

        • 1. Re: suggestionbox inside dataTable
          thierry baudouin Newbie

          sorry for the syntax mistakes in my previous message.

          just for say that input form with suggestion in xhtml code is ok
          when the code is outside the dataTable.

          • 2. Re: suggestionbox inside dataTable
            Ilya Shaikovsky Master

            check please a4j:log and server console.

            • 3. Re: suggestionbox inside dataTable
              thierry baudouin Newbie

              ok, i added <a4j:log> in xhtml file.

              in this case, i tape character 'b' in <h:inputText> :

              debug[21:18:24,734]: Observer event occurs
              debug[21:18:24,736]: Call data for update choices
              debug[21:18:24,738]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: keypress
              debug[21:18:24,739]: NEW AJAX REQUEST !!! with form :_id123
              debug[21:18:24,741]: Append text control _id123:_id124:0:joueur with value and value attribute [BEAUREPAIRE MICKAEL]
              debug[21:18:24,743]: Append text control _id123:_id124:0:_id140 with value [] and value attribute []
              debug[21:18:24,745]: Append text control _id123:_id124:0:_id142 with value [ 35 25 50] and value attribute [ 35 25 50]
              debug[21:18:24,747]: Append text control _id123:_id124:1:joueur with value [BAUDOUIN Thierry] and value attribute [BAUDOUIN Thierry]
              debug[21:18:24,749]: Append text control _id123:_id124:1:_id140 with value [] and value attribute []
              debug[21:18:24,751]: Append text control _id123:_id124:1:_id142 with value [ 25 35 50] and value attribute [ 25 35 50]
              debug[21:18:24,752]: Append text control _id123:_id124:2:joueur with value [PACHOT Benoit] and value attribute [PACHOT Benoit]
              debug[21:18:24,754]: Append text control _id123:_id124:2:_id140 with value [] and value attribute []
              debug[21:18:24,756]: Append text control _id123:_id124:2:_id142 with value [ 25 35 50] and value attribute [ 25 35 50]
              debug[21:18:24,757]: Append text control _id123:_id124:3:joueur with value [HANNEQUART FLORENT] and value attribute [HANNEQUART FLORENT]
              debug[21:18:24,759]: Append text control _id123:_id124:3:_id140 with value [ 40 45] and value attribute [ 40 45]
              debug[21:18:24,761]: Append text control _id123:_id124:3:_id142 with value [ 45] and value attribute [ 45]
              debug[21:18:24,763]: Append text control _id123:_id124:4:joueur with value [TOMASZEK Stephane] and value attribute [TOMASZEK Stephane]
              debug[21:18:24,764]: Append text control _id123:_id124:4:_id140 with value [ 45] and value attribute [ 45]
              debug[21:18:24,766]: Append text control _id123:_id124:4:_id142 with value [ 45 40] and value attribute [ 45 40]
              debug[21:18:24,768]: Append text control _id123:_id124:5:joueur with value [GERBAUD LAURENT] and value attribute [GERBAUD LAURENT]
              debug[21:18:24,770]: Append text control _id123:_id124:5:_id140 with value [ 45 40] and value attribute [ 45 40]
              debug[21:18:24,772]: Append text control _id123:_id124:5:_id142 with value [ 45] and value attribute [ 45]
              debug[21:18:24,774]: Append hidden control autoScroll with value [] and value attribute [null]
              debug[21:18:24,775]: Append hidden control _id123_SUBMIT with value [1] and value attribute [1]
              debug[21:18:24,777]: Append hidden control _id123:_idcl with value [] and value attribute []
              debug[21:18:24,778]: Append hidden control _id123:_link_hidden_ with value [] and value attribute []
              debug[21:18:24,780]: Append hidden control javax.faces.ViewState with value [rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAIxOHB0ACUvcmljaGZhY2VzL3Jlc3VsdGF0L3NhaXNpZWluZGl2LnhodG1s] and value attribute [rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAIxOHB0ACUvcmljaGZhY2VzL3Jlc3VsdGF0L3NhaXNpZWluZGl2LnhodG1s]
              debug[21:18:24,781]: parameter _id123:_id124:0:_id134 with value _id123:_id124:0:_id134
              debug[21:18:24,782]: parameter inputvalue with value b
              debug[21:18:24,784]: Start XmlHttpRequest
              debug[21:18:24,786]: Reqest state : 1
              debug[21:18:24,788]: QueryString: AJAXREQUEST=_viewRoot&_id123%3A_id124%3A0%3Ajoueur=b&_id123%3A_id124%3A0%3A_id140=&_id123%3A_id124%3A0%3A_id142=%2035%2025%2050&_id123%3A_id124%3A1%3Ajoueur=BAUDOUIN%20Thierry&_id123%3A_id124%3A1%3A_id140=&_id123%3A_id124%3A1%3A_id142=%2025%2035%2050&_id123%3A_id124%3A2%3Ajoueur=PACHOT%20Benoit&_id123%3A_id124%3A2%3A_id140=&_id123%3A_id124%3A2%3A_id142=%2025%2035%2050&_id123%3A_id124%3A3%3Ajoueur=HANNEQUART%20FLORENT&_id123%3A_id124%3A3%3A_id140=%2040%2045&_id123%3A_id124%3A3%3A_id142=%2045&_id123%3A_id124%3A4%3Ajoueur=TOMASZEK%20Stephane&_id123%3A_id124%3A4%3A_id140=%2045&_id123%3A_id124%3A4%3A_id142=%2045%2040&_id123%3A_id124%3A5%3Ajoueur=GERBAUD%20LAURENT&_id123%3A_id124%3A5%3A_id140=%2045%2040&_id123%3A_id124%3A5%3A_id142=%2045&autoScroll=&_id123_SUBMIT=1&_id123%3A_idcl=&_id123%3A_link_hidden_=&javax.faces.ViewState=rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAIxOHB0ACUvcmljaGZhY2VzL3Jlc3VsdGF0L3NhaXNpZWluZGl2LnhodG1s&_id123%3A_id124%3A0%3A_id134=_id123%3A_id124%3A0%3A_id134&inputvalue=b&
              debug[21:18:24,789]: Reqest state : 1
              debug[21:18:25,061]: Reqest state : 2
              debug[21:18:25,064]: Reqest state : 3
              debug[21:18:25,065]: Reqest state : 4
              debug[21:18:25,066]: Reqest end with state 4
              debug[21:18:25,067]: Response with content-type: text/xml;charset=UTF-8
              debug[21:18:25,069]: Full response content: <?xml version="1.0"?> <!-- MYFACES JAVASCRIPT --> <!-- function getScrolling() { var x = 0; var y = 0;if (self.pageXOffset || self.pageYOffset) { x = self.pageXOffset; y = self.pageYOffset; } else if ((document.documentElement && document.documentElement.scrollLeft)||(document.documentElement && document.documentElement.scrollTop)) { x = document.documentElement.scrollLeft; y = document.documentElement.scrollTop; } else if (document.body) { x = document.body.scrollLeft; y = document.body.scrollTop; } return x + "," + y; } //-->
              debug[21:18:25,070]: Header Ajax-Update-Ids not found, search in
              debug[21:18:25,072]: search for elements by name 'meta' in element #document
              debug[21:18:25,073]: getElementsByTagName found 2
              debug[21:18:25,075]: Find
              warn[21:18:25,076]: No information in response about elements to replace
              debug[21:18:25,077]: call getElementById for id= ajax-update-ids
              debug[21:18:25,079]: Hidden JSF state fields: [object HTMLSpanElement]
              debug[21:18:25,080]: Namespace for hidden view-state input fields is undefined
              debug[21:18:25,081]: search for elements by name 'input' in element span
              debug[21:18:25,083]: getElementsByTagName found 2
              debug[21:18:25,084]: Replace value for inputs: 30 by new values: 2
              debug[21:18:25,085]: Input in response: jsf_sequence
              debug[21:18:25,090]: Input in response: javax.faces.ViewState
              debug[21:18:25,091]: Found same input on page with type: hidden
              debug[21:18:25,092]: Found same input on page with type: hidden
              debug[21:18:25,095]: Found same input on page with type: hidden
              debug[21:18:25,097]: search for elements by name 'INPUT' in element span
              debug[21:18:25,098]: getElementsByTagName found 0
              debug[21:18:25,099]: Replace value for inputs: 30 by new values: 0
              debug[21:18:25,101]: call getElementById for id= _A4J.AJAX.focus
              debug[21:18:25,102]: No focus information in response
              debug[21:18:25,103]: Call request oncomplete function after processing updates
              debug[21:18:25,200]: call getElementById for id= _ajax:data
              debug[21:18:25,201]: AJAX response complete - updateChoices
              debug[21:18:25,210]: Choices updated

              i use richFaces3.0.2

              • 4. Re: suggestionbox inside dataTable
                thierry baudouin Newbie

                maybe it has importance, i forgot the 2 first lines in my text past :

                set timeout for request suggestion
                debug[0:14:46,807]: Observer event occurs
                debug[0:14:46,809]: Call data for update choices
                debug[0:14:46,811]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: keypress

                is it strange to have "set timeout for request suggestion" ?

                i also try to change library ajax4jsf-1.1.2.jar --> ajax4jsf-1.1.1.jar but no effect.

                thanks

                • 5. Re: suggestionbox inside dataTable
                  Ilya Shaikovsky Master

                  I'm unable to see your rich faces version?

                  • 6. Re: suggestionbox inside dataTable
                    thierry baudouin Newbie

                    my rich faces version is 3.0.2

                    • 7. Re: suggestionbox inside dataTable
                      Ilya Shaikovsky Master

                      please try to update with RF 3.1.0 RC5

                      • 8. Re: suggestionbox inside dataTable
                        thierry baudouin Newbie

                        ok, i migrated (with difficulties) with richfaces 3.1.0.RC5 :

                        my env is :
                        linux
                        jboss 4.0.4
                        commons-beanutils-1.7.0.jar
                        jsf-facelets-1.1.12.jar
                        commons-collections-3.2.jar
                        jsf-impl-1.2_04-p02.jar
                        commons-digester-1.8.jar
                        jstl-1.0.jar
                        commons-logging-1.0.4.jar
                        nekohtml-0.9.5.jar
                        el-api-1.0.jar richfaces-api-3.1.0-SNAPSHOT.jar
                        el-impl-1.0.jar richfaces-impl-3.1.0-SNAPSHOT.jar
                        jhighlight-1.0.jar richfaces-ui-3.1.0-SNAPSHOT.jar
                        jsf-api-1.2_04-p02.jar
                        xercesImpl-2.4.0.jar

                        i have the same problem like before with rf 3.0.2 (no list appear).

                        <a4j:log> put this :

                        debug[22:30:12,981]: set timeout for request suggestion
                        debug[22:30:13,016]: Observer event occurs
                        debug[22:30:13,018]: Call data for update choices
                        debug[22:30:13,019]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: keypress
                        debug[22:30:13,020]: NEW AJAX REQUEST !!! with form :j_id186
                        debug[22:30:13,023]: Append hidden control j_id186 with value [j_id186] and value attribute [j_id186]
                        debug[22:30:13,024]: Append text control j_id186:j_id187:0:joueur with value [GUICHARD PATRICE] and value attribute [GUICHARD PATRICE]
                        debug[22:30:13,026]: Append text control j_id186:j_id187:0:j_id202 with value [ 30 35] and value attribute [ 30 35]
                        debug[22:30:13,028]: Append text control j_id186:j_id187:0:j_id204 with value [ 30] and value attribute [ 30]
                        debug[22:30:13,029]: Append text control j_id186:j_id187:1:joueur with value [GERBAUD LAURENT] and value attribute [GERBAUD LAURENT]
                        debug[22:30:13,031]: Append text control j_id186:j_id187:1:j_id202 with value [] and value attribute []
                        debug[22:30:13,033]: Append text control j_id186:j_id187:1:j_id204 with value [ 30 30 35] and value attribute [ 30 30 35]
                        debug[22:30:13,035]: Append text control j_id186:j_id187:2:joueur with value and value attribute [PACHOT Benoit]
                        debug[22:30:13,036]: Append text control j_id186:j_id187:2:j_id202 with value [ 30 30] and value attribute [ 30 30]
                        debug[22:30:13,038]: Append text control j_id186:j_id187:2:j_id204 with value [ 35] and value attribute [ 35]
                        debug[22:30:13,040]: Append text control j_id186:j_id187:3:joueur with value [HANNEQUART FLORENT] and value attribute [HANNEQUART FLORENT]
                        debug[22:30:13,042]: Append text control j_id186:j_id187:3:j_id202 with value [ 45] and value attribute [ 45]
                        debug[22:30:13,043]: Append text control j_id186:j_id187:3:j_id204 with value [ 45 40] and value attribute [ 45 40]
                        debug[22:30:13,045]: Append text control j_id186:j_id187:4:joueur with value [BEAUREPAIRE MICKAEL] and value attribute [BEAUREPAIRE MICKAEL]
                        debug[22:30:13,047]: Append text control j_id186:j_id187:4:j_id202 with value [] and value attribute []
                        debug[22:30:13,049]: Append text control j_id186:j_id187:4:j_id204 with value [ 45 45 40] and value attribute [ 45 45 40]
                        debug[22:30:13,050]: Append text control j_id186:j_id187:5:joueur with value [pa] and value attribute [BAUDOUIN Thierry]
                        debug[22:30:13,052]: Append text control j_id186:j_id187:5:j_id202 with value [ 45 45] and value attribute [ 45 45]
                        debug[22:30:13,054]: Append text control j_id186:j_id187:5:j_id204 with value [ 40] and value attribute [ 40]
                        debug[22:30:13,056]: Append hidden control javax.faces.ViewState with value [_id8] and value attribute [_id8]
                        debug[22:30:13,057]: parameter j_id186:j_id187:5:j_id197 with value j_id186:j_id187:5:j_id197
                        debug[22:30:13,058]: parameter inputvalue with value pa
                        debug[22:30:13,060]: Start XmlHttpRequest
                        debug[22:30:13,061]: Reqest state : 1
                        debug[22:30:13,063]: QueryString: AJAXREQUEST=_viewRoot&j_id186=j_id186&j_id186%3Aj_id187%3A0%3Ajoueur=GUICHARD%20PATRICE&j_id186%3Aj_id187%3A0%3Aj_id202=%2030%2035&j_id186%3Aj_id187%3A0%3Aj_id204=%2030&j_id186%3Aj_id187%3A1%3Ajoueur=GERBAUD%20LAURENT&j_id186%3Aj_id187%3A1%3Aj_id202=&j_id186%3Aj_id187%3A1%3Aj_id204=%2030%2030%2035&j_id186%3Aj_id187%3A2%3Ajoueur=b&j_id186%3Aj_id187%3A2%3Aj_id202=%2030%2030&j_id186%3Aj_id187%3A2%3Aj_id204=%2035&j_id186%3Aj_id187%3A3%3Ajoueur=HANNEQUART%20FLORENT&j_id186%3Aj_id187%3A3%3Aj_id202=%2045&j_id186%3Aj_id187%3A3%3Aj_id204=%2045%2040&j_id186%3Aj_id187%3A4%3Ajoueur=BEAUREPAIRE%20MICKAEL&j_id186%3Aj_id187%3A4%3Aj_id202=&j_id186%3Aj_id187%3A4%3Aj_id204=%2045%2045%2040&j_id186%3Aj_id187%3A5%3Ajoueur=pa&j_id186%3Aj_id187%3A5%3Aj_id202=%2045%2045&j_id186%3Aj_id187%3A5%3Aj_id204=%2040&javax.faces.ViewState=_id8&j_id186%3Aj_id187%3A5%3Aj_id197=j_id186%3Aj_id187%3A5%3Aj_id197&inputvalue=pa&
                        debug[22:30:13,065]: Reqest state : 1
                        debug[22:30:13,386]: Reqest state : 2
                        debug[22:30:13,389]: Reqest state : 3
                        debug[22:30:13,435]: Reqest state : 4
                        debug[22:30:13,436]: Reqest end with state 4
                        debug[22:30:13,437]: Response with content-type: text/xml;charset=UTF-8
                        debug[22:30:13,438]: Full response content:
                        debug[22:30:13,440]: Header Ajax-Expired not found, search in
                        debug[22:30:13,441]: search for elements by name 'meta' in element #document
                        debug[22:30:13,450]: getElementsByTagName found 2
                        debug[22:30:13,452]: Find
                        debug[22:30:13,453]: Find
                        debug[22:30:13,455]: Header Ajax-Update-Ids not found, search in
                        debug[22:30:13,456]: search for elements by name 'meta' in element #document
                        debug[22:30:13,457]: getElementsByTagName found 2
                        debug[22:30:13,459]: Find
                        warn[22:30:13,460]: No information in response about elements to replace
                        debug[22:30:13,461]: call getElementById for id= ajax-view-state
                        debug[22:30:13,462]: Hidden JSF state fields: [object HTMLSpanElement]
                        debug[22:30:13,463]: Namespace for hidden view-state input fields is undefined
                        debug[22:30:13,464]: search for elements by name 'input' in element span
                        debug[22:30:13,466]: getElementsByTagName found 1
                        debug[22:30:13,468]: Replace value for inputs: 26 by new values: 1
                        debug[22:30:13,469]: Input in response: javax.faces.ViewState
                        debug[22:30:13,479]: Found same input on page with type: hidden
                        debug[22:30:13,480]: Found same input on page with type: hidden
                        debug[22:30:13,483]: Found same input on page with type: hidden
                        debug[22:30:13,485]: search for elements by name 'INPUT' in element span
                        debug[22:30:13,486]: getElementsByTagName found 0
                        debug[22:30:13,495]: Replace value for inputs: 26 by new values: 0
                        debug[22:30:13,497]: call getElementById for id= _A4J.AJAX.focus
                        debug[22:30:13,498]: No focus information in response
                        debug[22:30:13,499]: call getElementById for id= org.ajax4jsf.oncomplete
                        debug[22:30:13,500]: Call component oncomplete function after processing updates
                        debug[22:30:13,599]: call getElementById for id= _ajax:data
                        debug[22:30:13,600]: AJAX response complete - updateChoices
                        debug[22:30:13,609]: Choices updated

                        thanks for your help.

                        • 9. Re: suggestionbox inside dataTable
                          Ilya Shaikovsky Master

                          My working sample code:
                          View

                           <h:form>
                           <rich:dataTable value="#{capitalsBean.capitals}" var="cap" rows="20" border="1" id="table">
                           <h:column>
                           <h:inputText value="#{cap.name}" rendered="#{cap.checked}"></h:inputText>
                           <h:outputText value="#{cap.name}" rendered="#{not cap.checked}"></h:outputText>
                           </h:column>
                           <h:column>
                           <h:inputText value="#{cap.state}" rendered="#{cap.checked}"></h:inputText>
                           <h:outputText value="#{cap.state}" rendered="#{not cap.checked}"></h:outputText>
                           </h:column>
                           <h:column>
                           <h:selectBooleanCheckbox value="#{cap.checked}">
                           <a4j:support event="onclick" reRender="table"></a4j:support>
                           </h:selectBooleanCheckbox>
                           </h:column>
                           <h:column>
                           <h:inputText value="#{bean.property}" id="test">
                           </h:inputText>
                           <rich:suggestionbox height="200" width="200" for="test"
                           suggestionAction="#{bean.autocomplete}" var="cit">
                           <a4j:ajaxListener type="org.ajax4jsf.ajax.ForceRender"></a4j:ajaxListener>
                           <h:column>
                           <h:outputText value="#{cit.text}"></h:outputText>
                           </h:column>
                           </rich:suggestionbox>
                           </h:column>
                           </rich:dataTable>
                           <a4j:log popup="false" style="width:1000; height:300;"></a4j:log>
                           </h:form>
                          

                          Java
                          public List autocomplete(Object event) {
                           String pref = event.toString();
                           ArrayList result = new ArrayList();
                          
                           Iterator iterator = getAllData().iterator();
                           while (iterator.hasNext()){
                           Data elem = (Data)iterator.next();
                           if ((elem != null && elem.getText().toLowerCase().indexOf(pref.toLowerCase()) == 0) || "".equals(pref)){
                           result.add(elem);
                           }
                           }
                           FacesContext facesContext = FacesContext.getCurrentInstance();
                           facesContext.addMessage(null,
                           new FacesMessage(FacesMessage.SEVERITY_FATAL,
                           "This project no longer exists.",
                           "The project is not in the data store."));
                          
                           return result;
                           }
                          


                          Versions:
                          JSf 1.2._04
                          Facelets 1.1.12
                          RF 3.1.0 RC5

                          • 10. Re: suggestionbox inside dataTable
                            thierry baudouin Newbie

                            Hello,
                            i think i found reasons of the problem.

                            When i deploy richfaces-demo-3.1.0.war with tomcat 5.5 (standalone or inside jboss 4.0.4), i have an error during deployment :

                            GRAVE: Erreur lors de la configuration de la classe d'écoute de l'application (application listener) com.sun.faces.config.ConfigureListener
                            java.lang.NoClassDefFoundError: javax/el/CompositeELResolver
                            at java.lang.Class.getDeclaredConstructors0(Native Method)

                            i resolve the deployment with a rebuil of richfaces-demo-3.1.0.war (add in WEB-INF/lib el-api.jar and el-impl.jar) but i meet the problem that no list appear with suggestionBox inside a dataTable.

                            After, i tried a deployment with tomcat 6.0 and all is ok (the war is correctly deployed and suggestionBox works inside a dataTable).

                            But my production environement machine is jboss 4.0.4 with tomcat 5.5. What is the solution ?

                            thanks.

                            • 11. Re: suggestionbox inside dataTable
                              Ilya Shaikovsky Master

                              el-ri and el-api jars missed for your environment