4 Replies Latest reply on Feb 22, 2017 4:27 PM by Cary Gillam

    Input text loses focus ExtendedDataTable

    Cary Gillam Newbie

           I have an ExtenedDataTable with some outputText fields and and inputText field.  I am trying to change the color of the row when I enter a valid number into the inputText field and turns red when an invalid value is entered.  I have a keyup event in an a4j:ajax tag but when the table renders I lose focus.  So each time I press a key I have to click the field again to regain focus.  How can I do this?

       

      <rich:extendedDataTable id="extDataTable" styleClass="styleClass" var="var"
                columnClasses="columnClass1,columnClass2"
                rowClasses="rowClass" rowKeyVar="rowKeyvar"
                value="#{bean.records} selection="#{bean.selection}"
                selectionMode="single">
      
                <rich:column >
                     <f:facet name="header">
                           <div class="div1">
                                 <h:outputText value="Name" />
                            </div>
                     </f:facet>
                     <h:panelGroup id=idNameGroup">
                          <h:outputText value="#{bean.displayName}" />
                     </h:panelGroup>
                </rich:column>
                .
                .
                .
                  <rich:column >
                           <f:facet name="header">
                                <div class="div1">
                                      <h:outputText value="Number Value" />
                                </div>
                          </f:facet>
                          <a4j:outputPanel layout="block">
                               <h:inputText id="NewValue" maxlength="7"
                                      onkeypress="return event.keyCode!=13;"
                                      style="width:50px; height:12px;"
                                       value="#bean.currentValue[var.id]}"
                                    <f:converter converterId="numericConverter" />
                                    <a4j:ajax event="keyup" limitRender="true"
                                           listener="#{bean.actionModifyRecord(var.id, 'NewValue')}"
                                           render="extDataTable" execute="@this"/>
                              </h:inputText>
                           </a4j:outputPanel>
                  </rich:column>