Results 1 to 3 of 3

Thread: Popup form (in a window), any way to do control focus after rendering?

  1. #1

    Question Popup form (in a window), any way to do control focus after rendering?

    I'm popping a form in a window to allow for populating a data table. Everything is pretty straight forward. What I have done is create an "Add" button on the window to generate a new fieldset in the form. Now all this works fine. What I'm having problems understanding is how do I set the user's focus to the newly added fieldset (and/or the first field in the field set).

    I am aware that I can use defaultButton on windows, but it doesn't seem to address this problem because I've already got the window open and I'm dynamically adding fieldsets. Does anyone know of a solution for this?

    For completeness, this is how I'm adding the fieldset to the form.
    Code:
    ...
    //this is the formpanel
    //build up var newFieldSet...
    this.add(newFieldSet);
    if(this.rendered) {
      this.doLayout();
    }
    ...
    Wes

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Using the defaultButton is the safest option (it also refocusses after dragging or resizing the window).

    But you probably want:
    Code:
    this.defaultButton = <field-to-focus>;
    if(this.rendered) {
      this.doLayout();
      this.focus();
    }

  3. #3

    Default

    You are the king of all 2.5m-or-greater-wingspan avians!
    Wes

Similar Threads

  1. Cannot get focus into a TextField in a popup window?
    By the.jxc in forum Ext 3.x: Help & Discussion
    Replies: 20
    Last Post: 11 Aug 2010, 6:09 AM
  2. Popup window go behind the pdf control.
    By waqasrazzaq in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 9 Aug 2010, 6:24 AM
  3. Populate form in popup window. Form doesn't recieve data on 'load'
    By woffie in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 2 May 2010, 1:09 PM
  4. Popup Window lost focus
    By randomuser01 in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 8 Feb 2010, 1:09 AM
  5. Popup Window with Form example?
    By Bucs in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 17 Sep 2008, 4:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •