[CLOSED] Change panel width from Javascript

  1. #1

    [CLOSED] Change panel width from Javascript

    Hi,
    I would like to change panel width size from javascript.
    Here my code but don't work:

    Javascript code:

    <script type="text/javascript">
        var ExtraExpandMAP = function (pannello) {
            pannello.setWidth = 920;
        };
    </script>

    Asp.Net code:

    <ext:Panel ID="PanelLazyMAP" runat="server" 
    	Region="East" 
    	Width="460"                 
    	Title="Mappa"
    	Layout="Fit" 
    	Floatable="false"
    	Resizable="true"
    	Collapsed="true"                    
    	Collapsible="true"
    	AutoScroll="false"
    	BodyStyle="background-color:#ffffff;"
    	MarginSpec="84 0 0 0" AnimCollapse ="false">
    	<HeaderConfig>
    		<Items>
    			<ext:Button ID="btnExpandExtraMAP" runat="server" Icon="RewindGreen">
    				<Listeners>
    					<Click Handler="ExtraExpandMAP(#{PanelLazyMAP});">				
    					</Click>
    				</Listeners>
    			</ext:Button>
    		</Items>
    	</HeaderConfig>
    </ext:Panel>
    Does anyone have any idea?
    Thank you!


    Stefano
    Last edited by fabricio.murta; Mar 17, 2016 at 4:37 PM.
  2. #2
    Ops I apologize for the trouble.... I found the error in my code:

    instead of:
    pannello.setWidth = 920;
    coding:

    pannello.setWidth(920);

    For information, not working also:

    pannello.width = 920;
    You can mark as closed!

    Stefano
    Last edited by metatronix; Mar 17, 2016 at 2:18 PM.
  3. #3
    Hello! Thanks for sharing the outcome!

    For instance, panello.width = 920 actually works. But here, you are actually setting the width of the panel next time it is rendered on the screen. That's why you see no results with this. Should be set when defining the panel (in Page_Load() time, for example).

    So using the method setWidth(920) does not only set the width property, but also runs needed code to apply the settings on the fly.
    Fabrício Murta
    Developer & Support Expert
  4. #4
    Hello Fabricio!

    Thank you for the explanation!

Similar Threads

  1. [CLOSED] How to set Gridpanel Height and Width Dynamically from Javascript
    By hemantpatil in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 14, 2013, 9:36 AM
  2. Replies: 2
    Last Post: Nov 09, 2012, 4:32 PM
  3. [CLOSED] Grid Panel : Column width (Auto width)
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 24, 2011, 8:31 PM
  4. [CLOSED] Change width Confirmation
    By CarWise in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jun 07, 2011, 2:19 PM
  5. [CLOSED] change bodyStyle on panel in Javascript
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 03, 2009, 6:51 AM

Tags for this Thread

Posting Permissions