3 Replies Latest reply on Feb 8, 2011 9:01 AM by Tor Ã…ge Ballo

    Rich:autocomplete passing event to parent

    Tor Ã…ge Ballo Newbie

      Hi, I'm having some problems using the rich:autocomplete in a table or a three structure. The problem is that the event from the autocomplete i passed along to it's parent causing the parent to do things like change active row.

       

      I have recived the problem using openFaces threeTable but reproduced the problem in Richfaces extendedDataTable here:

       

      <ui:component>

          <rich:extendedDataTable value="#{eventBugBean.stringList}"

              var="varExtendedDataTable" id="table" sortMode="single"

              selectedClass="background-color: #D0D5E0">

       

              <rich:column width="180px" >

                  <h:outputText value="#{varExtendedDataTable}"/>

              </rich:column>

       

              <rich:column width="280px" >

                  <rich:autocomplete id="autocomplete" showButton="false" layout="list"

                      mode="ajax" var="varAutocomplete"

                      autocompleteMethod="#{eventBugBean.getAutocompleteList}">

                      #{varAutocomplete}

                  </rich:autocomplete>

              </rich:column>

       

          </rich:extendedDataTable>

      </ui:component>

       

      Is there any solution to this problem? I have attached a demo. (Try selecting the rows in the autocomplete and you will see that the active row in the extendedDataTable changes.)

       

      Best regards

      Tor Åge Ballo

        • 1. Rich:autocomplete passing event to parent
          Ilya Shaikovsky Master

          use onkeydown="event.stopPropagation();" at autocomplete. That's just a workaround. I will review jira and create new task if it's not there.

          • 2. Rich:autocomplete passing event to parent
            Tor Ã…ge Ballo Newbie

            Thank you very much, that solves the problem in the extendedDataTable, very nice if you post it in jira:).... But it do not solve the problem in my OpenFaces:treeTable.

             

            I can't quite understand that, but they must some how pick up the event even when I use the stopPropagation() function. I have posted it on the OpenFaces forum, here. 

             

            This is my code if anyone has a suggestion on how I may fix it:

             

                <o:treeTable id="treeTable" var="treeNode"

                    style="width: 100%;border: 1px solid #999999;">

             

                    <o:dynamicTreeStructure nodeChildren="#{eventBugBean.stringList}" />

                    <o:singleNodeSelection rendered="true" style="background: #D0D5E0;" />

             

                    <o:treeColumn style="width: 8%;">

                        <h:outputText value="#{treeNode}" />

                    </o:treeColumn>

             

                    <o:column style="width: 40%;">

                        <rich:autocomplete id="autocomplete2" showButton="false"

                            layout="list" mode="ajax" var="varAutocomplete"

                            onkeydown="event.stopPropagation();"

                            autocompleteMethod="#{eventBugBean.getAutocompleteList}">

                                #{varAutocomplete}

                           </rich:autocomplete>

                    </o:column>

             

                </o:treeTable>

             

            Best regards and thank you IIya for the quick response

            Tor Åge

            • 3. Rich:autocomplete passing event to parent
              Tor Ã…ge Ballo Newbie

              A valid workaround for the treeTable component is also setting onkeypress="event.stopPropagation();"

               

              Best regards

              Tor Åge