0 Replies Latest reply on May 3, 2011 8:59 AM by Sascha Janz

    set focus on inputtext inside extendeddatatable

    Sascha Janz Master

      hi,

       

      i got an extendeddatatable with inputtext inside it. on inputtext i want to set focus on the first inputtext. i tried javascript on oncomplete but doesn't work,

       

      has someone  a solution for this?

       

      page source is

       

      <?xml version="1.0" encoding="ISO-8859-15"?>
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:s="http://jboss.com/products/seam/taglib">
      <h:form id="testform">
      <a4j:commandButton value="ClickTest "  action="#{Test.addList}" oncomplete="document.getElementById('testform:wftbl:0:c1').focus();"  />
               <rich:extendedDataTable      enableContextMenu="false" rows="14"   selectionMode="single" rowKeyVar="rkv"        activeClass="active-row" selectedClass="active-row"  value="#{Test.data}" var="d" id="wftbl"       
            height="450px"  cellpadding="0" cellspacing="0"   width="1240px"     >
            
          <rich:column     id="rc4" style="text-align:left;" label="Spalte"  >   
            <f:facet name="header"   >
           <h:outputText id="t1" value="Spalte mit outputajax juhu?"  />
           </f:facet>
           <a4j:outputPanel id="output" ajaxRendered="true">
           <h:outputText  value="#{d.text1}"   id="c25"  />
           </a4j:outputPanel>
           </rich:column>
              <rich:column     id="rc2" style="text-align:left;" label="Spalte2"  >   
           <f:facet name="header"   >
           <h:outputText id="t2" value="Spalte2"  />
           </f:facet>
           <h:inputText  value="#{d.text2}"   id="c1"  >
           <a4j:support event="onchange" action="#{Test.resetText}"    onsubmit="document.getElementById('testform:testid').value=this.id" />
           </h:inputText>
          </rich:column>
         
      </rich:extendedDataTable>
      </h:form>

       

      </ui:composition>