Results 1 to 9 of 9

Thread: newbie question, floating buttons

  1. #1

    Default newbie question, floating buttons

    Hi gurus,

    i am here again with another noob's question. This is my script simply:
    Code:
    var mainCnt = new Ext.Window({
    //...configuration bla
    listeners: {
    render: function(){
    for(i=0; i<50; i++){
    mainCnt.add(new Ext.Button({
    text: i,
    id: 'nmr'+i
    }));
    }
    }
    }
    });
    So i add 50 buttons dynamically after the render event and it works. But i want to align them like i do with css float property so 5 lines and 10 rows. I've tried align to but i get error, alignTo is not a function. This is what i put in the foor loop:
    Code:
    if(i>0){
    Ext.getCmp('nmr'+i).alignTo(Ext.getCmp('nmr'+(i-1)), 'r');
    }
    But it seems not to work. I've also tried to get the dom element with getEl and apply the function but it didn't help too. How can i solve this issue, any idea? Thanks in advance.

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Put them in a layout. Look at the hbox/vbox examples.
    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

    Default

    i assume hbox layout is available for the layouts that has floating property. Buttons don't have that but i will try to put them in an additional container. Thanks for the hint.

  4. #4

    Default

    i still get the same error:

    Ext.Container.LAYOUTS[this.layout.toLowerCase()] is not a constructor

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    It would seem obvious that the layout string which you are using is not a valid property of the Ext.Container.LAYOUTS hash. What are you using?

  6. #6

    Default

    i am using hbox string for the layout. I've tried the hbox example of garcia, it seemed to work on example. I don't see any difference between my structure and his structure but hbox doesn't get recognised as layout type. I tought, button wouldn't support floating since button doesn't have floating property. So i put little Ext.Panels to avoid it and buttons inside the panels. But it didn' help either. I wendt one step further and copied garcia's script entirely but i get the same error. I've downloaded the same JS library and replaced it and still get the same error. When i add style: 'float: left' property, i don't get js error but layout gets messed up.

  7. #7
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Any reason you are not using the new ButtonGroup component?

    (assuming you are using Ext 3.0, since you posted in the 3.0 forum)

  8. #8
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    Quote Originally Posted by eyurdakul View Post
    i am using hbox string for the layout. I've tried the hbox example of garcia, it seemed to work on example. I don't see any difference between my structure and his structure but hbox doesn't get recognised as layout type. I tought, button wouldn't support floating since button doesn't have floating property. So i put little Ext.Panels to avoid it and buttons inside the panels. But it didn' help either. I wendt one step further and copied garcia's script entirely but i get the same error. I've downloaded the same JS library and replaced it and still get the same error. When i add style: 'float: left' property, i don't get js error but layout gets messed up.
    The box layouts are Ext 3.* only.

    Why don't you use a table layout if you are using 2.2?

  9. #9

    Default

    thanks animal it did the trick

Posting Permissions

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