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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,029
    Answers
    3976
    Vote Rating
    1367
      0  

    Default

    Have you insured it's the component you want and have you inspected the DOM?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    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
  •