Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Binding too late in rendering so not usable to drive 'hidden'

    You found a bug! We've classified it as EXTJS-15742 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,295
    Vote Rating
    117
      0  

    Default Binding too late in rendering so not usable to drive 'hidden'

    We drive lot of our UI using binding against 'hidden' so to hide or show stuff, sometime we alternative part of the ui depending of the state, so x will show but not y, and alternate.

    At startup, initial rendering, everything 'hidden' true via binding shows first, then disappear. That doesn't look good.

    This is an example, it's visible but you have to pay attention, maybe we could had extra wait during rendering.

    https://fiddle.sencha.com/#fiddle/d7j

  2. #2
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,064
    Vote Rating
    962
      0  

    Default

    Not really a bug, but certainly a limitation.

    We have a ticket open to look at ways to provide bindings to trigger earlier than render time.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,295
    Vote Rating
    117
      0  

    Default

    The override we use:
    Code:
    Ext.define('Ext.overrides.Component',{
    	override:'Ext.Component',
    	initComponent:function(){
    		if(this.getBind()){
    			var keys=Ext.Object.getKeys(this.getBind());
    			
    			if(Ext.Array.some(
    				keys,
    				function(item){
    					return item==='hidden'||item==='visible';
    				}
    			)){
    				this.hidden=true;
    			
    			}
    		}
    		this.callParent(arguments);
    	}
    });

  4. #4
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,295
    Vote Rating
    117
      0  

    Default

    Opened support ticket-21676 for this since it's dragging and I got hit again by this in a new app.

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2015
    Posts
    6
    Vote Rating
    0
      0  

    Default

    We are facing the same issue right now, but as a workaround we usually just set the hidden config as true by default, then the bind takes effect after the render.

  6. #6
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,295
    Vote Rating
    117
      0  

    Default

    This issue keep coming back to the surface. IE8 is showing the popup about killing the long running script because of the repetitive layouts for the many late bindings occurring.

  7. #7
    Sencha Premium User SebTardif's Avatar
    Join Date
    Feb 2011
    Location
    Cambridge, MA
    Posts
    1,295
    Vote Rating
    117
      0  

    Default

    Workaround:

    Code:
     listeners: {
            afterrender: function () {
                this.lookupViewModel().getScheduler().notify();
            }
        }

  8. #8
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    761
    Vote Rating
    64
      0  

    Default

    A faster and simple override to workaround this.
    Code:
    Ext.define('Ext.patches.Component', {
        override: 'Ext.Component',
        compatibility: '6.0.0.640',
        initComponent: function () {
            if (this.getBind()) {
                var keys = Ext.Object.getKeys(this.getBind());
    
                this.hidden = keys.indexOf('hidden') > -1 ? true : (keys.indexOf('visible') > -1 ? true : false);
            }
            this.callParent(arguments);
        }
    });
    Wemerson Januario
    Blog: http://wemersonjanuario.com.br
    Contrate-me/Hire me on: https://www.upwork.com/fl/wemersonjanuario
    From: Goiânia, GO, Brazil
    Sencha Consultant and Web Developer

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

    modern toolkit locale package - https://github.com/wemersonjanuario/modern-locale

  9. #9
    Sencha Premium Member
    Join Date
    May 2011
    Posts
    167
    Vote Rating
    12
      0  

    Default

    Quote Originally Posted by wemerson.januario View Post
    A faster and simple override to workaround this.
    Code:
    Ext.define('Ext.patches.Component', {
        override: 'Ext.Component',
        compatibility: '6.0.0.640',
        initComponent: function () {
            if (this.getBind()) {
                var keys = Ext.Object.getKeys(this.getBind());
    
                this.hidden = keys.indexOf('hidden') > -1 ? true : (keys.indexOf('visible') > -1 ? true : false);
            }
            this.callParent(arguments);
        }
    });
    I just took this override out, because it was messing up our nested viewmodels. I havent found out the reason yet except from thinking that this.getBind() is taking a bind before it is available which is making it null.

  10. #10
    Sencha Premium Member
    Join Date
    Oct 2015
    Posts
    22
    Vote Rating
    3
      0  

    Default

    A bugfix for this problem would be a great help.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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