ext:window field loosing focus

  1. #1

    ext:window field loosing focus

    Hello,

    I have an ext:Window that has an ext:Textfield in it. When the window opens, the focus goes in the textfield one time then leaves the field. This is frustrating because I want the focus on the field so that the user can start typing as soon as the window opens.

    Here's the window code:

    <ext:Button ID="ShowStudentGridWindowButton" runat="server" Text="Student Name:">
      <Listeners>
        <Click Handler="#{winFindStudent}.show();" />
      </Listeners>
    </ext:Button>
    <ext:Window ID="winFindStudent" runat="server" 
      Collapsible="true" 
      Icon="Application"
      Title="Student Search" 
      AutoHeight="true" 
      Width="700" 
      Modal="true" 
      Show&#111;nload="false"
      BodyStyle="padding: 6px;">
      <Body>
        <table border="0">
          <tr>
            <td>Enter a name or student ID:</td>
            <td>
              <ext:TextField ID="SearchStringField" runat="server" EnableKeyEvents="true" FocusClass="highlight">
                <AjaxEvents>
                  <KeyPress Before="var e = params[1]; var isEnter = e.getKey() == e.ENTER; if(isEnter){e.preventDefault();} return isEnter;" OnEvent="SearchString">
                    <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{gpFindStudent}" />
                  </KeyPress>
                </AjaxEvents>
              </ext:TextField>
            </td>
          </tr>
          <tr>
            <td>I left out the data</td>
          </tr>
        </table>
      </Body>
    
      <Listeners>
        <Show Handler="#{SearchStringField}.focus();" />
      </Listeners>
    </ext:Window>
  2. #2

    RE: ext:window field loosing focus

    Hi jmilton,

    I think just adding a slight delay to the <Click> Listener should solve the problem.

    Example

    <Show Handler="#{SearchStringField}.focus();" Delay="50" />
    Hope this helps.

    Geoffrey McGill
    Founder
  3. #3

    RE: ext:window field loosing focus

    Thanks!

    Works great!

    James

Similar Threads

  1. [CLOSED] Focus first field in RowEditor when shown.
    By pj_martins in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 22, 2011, 3:50 PM
  2. Focus first field in form when TAB is pressed
    By chezinho in forum 1.x Help
    Replies: 2
    Last Post: Dec 08, 2010, 9:02 PM
  3. [CLOSED] Default field focus.
    By Jean-Pierre Poulin in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 15, 2010, 11:18 AM
  4. [CLOSED] ComboBox loosing value
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jul 21, 2009, 5:27 AM
  5. Replies: 0
    Last Post: Jun 03, 2009, 3:14 PM

Posting Permissions