Results 1 to 3 of 3

Thread: how to dynamically change button size

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    35
    Vote Rating
    0
      0  

    Default how to dynamically change button size

    Hi,

    I am using ST 1.1 and I have to dynamically change button width & height according to device dimensions.

    I have made buttons using an image specified in css file
    Code:
                        xtype: 'button',
                        cls:'btnCityCashback',
                        name : 'cityCashBack',
                        id:'cityCashBack',
    I have not specified size of image in css file.

    I have obtained width and height of viewport in cardcontroller.js
    Code:
    var viewportwidthcc= Ext.Element.getViewportWidth();
    var viewportheightcc= Ext.Element.getViewportHeight();
    Then I have obtained button object using
    Code:
    var btnCityCashback = Ext.getCmp('cityCashBack');
    and then later on did
    Code:
    var rtn=btnCityCashback.setWidth(some width);
    but it is not working and button is displayed in some default size.

    Please help

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    Have you insured it's the component you want and have you inspected the DOM?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    35
    Vote Rating
    0
      0  

    Default

    It worked. I was calling setWidth from wrong place. I moved it to app.js

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
  •