You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default [Feature Request] Render windows without focus them

    [Feature Request] Render windows without focus them


    Hi,

    i have the situation that i render a bunch of windows in a container that scrolls. If i do so, it takes a lot of time because each window rendered gets focus, the container scroll jumps a lot and this doesn't look nice.

    Render the windows without focus mage render process up to 4 times faster and looks much better. So fucus window for a single window is okay, but mass action is horrible.

    The following override was done by me to achieve it, it's very simple, and i use a property in Window
    noFocus: true

    Here is the override:

    Code:
    Ext.override(Ext.Window, {
    	afterShow : function(isAnim) {
    		if (this.isDestroyed) {
    			return false;
    		}
    		this.proxy.hide();
    		this.el.setStyle('display', 'block');
    		this.el.show();
    		if (this.maximized) {
    			this.fitContainer();
    		}
    		if (Ext.isMac && Ext.isGecko2) {
    			this.cascade(this.setAutoScroll);
    		}
    
    		if (this.monitorResize || this.modal || this.constrain || this.constrainHeader) {
    			Ext.EventManager.onWindowResize(this.onWindowResize, this);
    		}
    		this.doConstrain();
    		this.doLayout();
    		if (this.keyMap) {
    			this.keyMap.enable();
    		}
    		if (!this.noFocus) {
    			this.toFront();
    		}
    		this.updateHandles();
    		if (isAnim && (Ext.isIE || Ext.isWebKit)) {
    			var sz = this.getSize();
    			this.onResize(sz.width, sz.height);
    		}
    		this.onShow();
    		this.fireEvent('show', this);
    	}
    });
    I would love to see this in EXT4, also as this is a very small and easy change.
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    You should be able to configure your Window with

    Code:
    focus: Ext.emptyFn
    and it won't be able to focus itself.

  3. #3
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    Hi Nige,

    if i do so i lose focus functionality of the window. i only want to exclude it while render.
    So maybe naming of the property is misleading, should read
    noFocusOnRender
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Probably better would be to have a special value of the defaultFocus config which specifies no focussing.

    This is what used to be the defaultButton config, and specifies a Component to focus upon focusing the Window.

    I'll look at ways of specifying "do not focus anything", and document any solution on the defaultFocus config option.

  5. #5
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    thanks!
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    OK, thinking about this more, what you need if you are showing (with autoRender on first show) a bunch of Windows is for the last Window to focus itself, not each one as it is shown.

    I think the best thing is that the focus task be buffered, so that if another Window requests focus for itself within 1 few milliseconds, the first focus is canceled.

    That way, after showing 10 Windows, only the automatic focus for the last Window will be processed. This seems like the best solution, requires no configs, and makes the most sense intuitively.

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    OK, it's much better now. There used to be an Ext.util.DelayedTask set up in every Component to handle delayed focus.

    Now there's just one shared by all Components.

    Because obviously, only ONE component can actually have focus at any one time! So the last one to request focus gets it, and any others focused in one contiguous set of focus() calls never actually get focus; their delayed focus request gets cancelled.

  8. #8
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    could you share your code for this solution, if you already have some? I got the idea, but don't see how to do it easy (eg "Now there's just one shared by all Components") - how do you integrate it?
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  9. #9
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    You'll have to wait and see....

    Only a few days until the next preview.

  10. #10
    Sencha User steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,664
    Vote Rating
    7
    steffenk has a spectacular aura about steffenk has a spectacular aura about steffenk has a spectacular aura about

      0  

    Default


    ok

    btw - it's not needed to focus last window. In my case i render windows from top to bottom, and i don't want to focus the last window - just none. The container should stay with scrollTop 0 and user can scroll and focus any by click
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

Similar Threads

  1. Replies: 12
    Last Post: 17 Feb 2010, 12:28 AM
  2. detached windows feature?
    By jaguarg in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 12 Oct 2008, 3:11 AM
  3. TreeLoader: new feature request and patch to add this feature
    By osantana in forum Community Discussion
    Replies: 3
    Last Post: 12 Jun 2008, 9:42 AM

Thread Participants: 1