1. #1
    Sencha User
    Join Date
    Jul 2010
    Posts
    27
    Vote Rating
    0
    melmac is on a distinguished road

      0  

    Thumbs up myPanel.setHeight('auto')

    myPanel.setHeight('auto')


    Ok I might have missed something but in extjs 3.3 I was able to manually set the height of a Panel, until I wished to allow the Layout Manager to, well, manage the height once more with myPanel.setHeight('auto').

    If I do this in extjs 4 I get the warning: Warning, size detected as NaN on Element.addUnits.

    So is there anyway to return control to the Layout Manager in version 4?

    Many thanks

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,735
    Vote Rating
    756
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Have you tried doLayout on the parent component?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2010
    Posts
    27
    Vote Rating
    0
    melmac is on a distinguished road

      0  

    Default


    Thanks for the response. That doesn't seem to work. I've attempted to create an example to show what I'm doing:

    Basically I have a Parent Panel, and when a button is clicked new child panels are added (in my application they are labels). As these are added the parent resizes to accommodate them with the help of the layout manager, but once a certain number are added (in this case 4), the parent panel size is locked to stop it expanding any further, and further children are added with a scrollbar.


    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
        "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
       <link rel="stylesheet" type="text/css" href="../../../../ext/resources/css/ext-all.css">
        <script type="text/javascript" src="../../../../ext/bootstrap.js"></script>
     
    		
    	<script type="text/javascript">Ext.onReady(function(){
    
    		var win = new Ext.Window({
    	
    	 			width: 10,
    				items:[
    				{
    						xtype: 'panel',						
    						dockedItems: [{
    							dock: 'top',
    							xtype: 'toolbar',
    							items: [{
    									text: 'addLabel',
    									handler: function()
    									{
    										var panel = this.ownerCt.ownerCt;
    
    										//Layout Manager automatically resizes the panel to make space for new panel, until there are 4 items
    										if(panel.items.items.length === 4)
    										{
    							
    											//lock the panel at its current height by explicitly setting its size
    											panel.setHeight(panel.getHeight());
    											panel.setAutoScroll(true);
    										}										
    
    											panel.add({
    												xtype: 'panel',
    												html: 'this is label' + panel.items.items.length,	
    												columnWidth: 1
    											});										
    											panel.doComponentLayout();
    										//panel.ownerCt.doLayout();
    									}										
    								},
    								'->',
    								{
    									text: 'removeLabel',
    									handler: function()
    									{
    										var panel = this.ownerCt.ownerCt;	
    										var panelLength = panel.items.items.length
    
    										if(panelLength === 3)
    										{
    											//return sizing control back to layout manager
    											panel.setHeight('auto');
    											panel.setAutoScroll(false);
    										}
    
    										if(panelLength > 0)
    										{
    											panel.remove(panel.items.items[panelLength-1]);	
    										}
    										else
    										{
    											panel.add({
    												xtype: 'panel',
    												html: 'nothing to remove',	
    												columnWidth: 1
    											});		
    			
    										}
    										panel.doComponentLayout();				
    									}
    							}]		
    				   		}],
    					items:[]					
    				}] 					
    		}).show();
    	});</script>
        
    </head>
    <body> 
    </body>
    
    </html>
    What I need is to be able to unlock the sizing restriction and allow the layout manager to resize the parent panel once the the number of child panels is less than (say 4), so it will shrink accordingly. Basically, unset the property I have set

    In Extjs 3.3 setHeight('auto') did this. but now this gives an error. Using undefined doesn't work either

  4. #4
    Sencha User
    Join Date
    Jul 2010
    Posts
    27
    Vote Rating
    0
    melmac is on a distinguished road

      0  

    Default


    Ok I've found a way that doesnt involve me taking over from the layout manager (I should never have fired him)


    Code:
    	
            if(panelLength === 3)
    	{
    		//explicitly delete the property
    		delete panel.height;
    		
    		panel.setAutoScroll(false);
    	}
    I'm not really sure if it's a hack or an elegant solution though ...

    troubling

  5. #5
    Sencha User
    Join Date
    Sep 2012
    Posts
    1
    Vote Rating
    0
    MiF is on a distinguished road

      0  

    Default


    try setHeight(null)

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    3
    Vote Rating
    0
    MNMNT is on a distinguished road

      0  

    Default yeah

    yeah


    Too bad Extjs is really stupid - it detects a width as a floating number and then when it tries to set the width or height, the addUnits function craps out with a NaN error. Thanks Sencha.

Similar Threads

  1. [CLOSED] cmp.el.setHeight() breaks cmp.setHeight()
    By NeoVanGoth in forum Ext 3.x: Bugs
    Replies: 3
    Last Post: 9 Apr 2010, 12:08 PM
  2. setHeight() not working
    By arthurakay in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 13 Jan 2009, 1:35 PM
  3. setHeight and IE7
    By Yasheena in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 16 Oct 2008, 5:04 AM
  4. setHeight(string) bug?
    By Gabor Turi in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 12 Sep 2008, 6:35 AM
  5. Is it a Bug in setHeight?
    By ethraza in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 5 Jul 2007, 3:20 AM

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar