1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    143
    Answers
    5
    Vote Rating
    0
    rockinthesixstring is on a distinguished road

      0  

    Default Answered: SegmentedButton - button.text is 'undefined'

    Answered: SegmentedButton - button.text is 'undefined'


    I'm working through the SegmentedButton docs and I'm trying to add a listener for the buttons.

    Problem is that it's text is undefined. Not sure why.

    PHP Code:
    {            // BUTTON ROW
                
    xtype'segmentedbutton',
                
    layout: {
                    
    type'hbox',
                    
    pack'center',
                    
    align'middle'
                
    },
                
    allowMultiplefalse,
                
    config: {
                    
    baseCls'plain',
                    
    pressedCls''
                
    },
                
    items: [{
                    
    text'videos'
                
    }, {
                    
    text   'calendar'
                
    }, {
                    
    text'sites'
                
    }],
                
    listeners: {
                    
    toggle: function(containerbuttonpressed){
                        
    console.log(button.text);  // UNDEFINED
                        
    console.log("User toggled the '" button.text "' button: " + (pressed 'on' 'off'));
                    }
                }
            } 

  2. Okay, that is odd, can't reproduce that behavior. When printing out the button argument you should see something like this:

    Code:
    • _cls: Array[2]
    • _iconAlign: "left"
    • _itemId: "ext-button-7"
    • _pressedDelay: 0
    • _styleHtmlCls: "x-html"
    • _text: "sites"
    • config: Ext.Object.classify.objectClass
    • [...redacted...]
    • __proto__: TemplateClass
      • $className: "Ext.Button"
      • [...redacted...]
    calling getText() on that object works as expected.
    I'm using ST2 Beta2.

  3. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    49
    Answers
    6
    Vote Rating
    0
    j.k is on a distinguished road

      0  

    Default


    try button.getText()

  4. #3
    Sencha User
    Join Date
    May 2011
    Posts
    143
    Answers
    5
    Vote Rating
    0
    rockinthesixstring is on a distinguished road

      0  

    Default


    Quote Originally Posted by j.k View Post
    try button.getText()
    nope, sorry.. that's not it.

  5. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    49
    Answers
    6
    Vote Rating
    0
    j.k is on a distinguished road

      0  

    Default


    I haven't tested, but are you sure the button is passed as the second argument to your event handler function and not the first one? When in doubt do a
    console.log(arguments)
    and inspect the passed values

  6. #5
    Sencha User
    Join Date
    May 2011
    Posts
    143
    Answers
    5
    Vote Rating
    0
    rockinthesixstring is on a distinguished road

      0  

    Default


    Quote Originally Posted by j.k View Post
    I haven't tested, but are you sure the button is passed as the second argument to your event handler function and not the first one? When in doubt do a
    console.log(arguments)
    and inspect the passed values
    I'm actually logging as much as I can
    Code:
        console.log(container);
        console.log(button);
        console.log(pressed);
        console.log(button.text);
    I can see in the output of the 'button' the right value for '_text', but it's private and inaccessible

    + Ext.apply.create.Class
    • _badgeCls: "x-badge"
    • _baseCls: "x-button"
    • _cls: Array[2]
    • _hasBadgeCls: "x-hasbadge"
    • _iconAlign: "left"
    • _iconMaskCls: "x-icon-mask"
    • _itemId: "ext-button-1"
    • _labelCls: "x-button-label"
    • _pressedCls: "x-button-rpc-pressed"
    • _pressedDelay: 0
    • _style: "margin-top: 5px;"
    • _styleHtmlCls: "x-html"
    • _text: "videos"
    • _ui: "plain"
    .

  7. #6
    Sencha User
    Join Date
    Jan 2012
    Posts
    49
    Answers
    6
    Vote Rating
    0
    j.k is on a distinguished road

      0  

    Default


    Okay, that is odd, can't reproduce that behavior. When printing out the button argument you should see something like this:

    Code:
    • _cls: Array[2]
    • _iconAlign: "left"
    • _itemId: "ext-button-7"
    • _pressedDelay: 0
    • _styleHtmlCls: "x-html"
    • _text: "sites"
    • config: Ext.Object.classify.objectClass
    • [...redacted...]
    • __proto__: TemplateClass
      • $className: "Ext.Button"
      • [...redacted...]
    calling getText() on that object works as expected.
    I'm using ST2 Beta2.

  8. #7
    Sencha User
    Join Date
    May 2011
    Posts
    143
    Answers
    5
    Vote Rating
    0
    rockinthesixstring is on a distinguished road

      0  

    Default


    Quote Originally Posted by j.k View Post
    Okay, that is odd, can't reproduce that behavior. When printing out the button argument you should see something like this:

    Code:
    • _cls: Array[2]
    • _iconAlign: "left"
    • _itemId: "ext-button-7"
    • _pressedDelay: 0
    • _styleHtmlCls: "x-html"
    • _text: "sites"
    • config: Ext.Object.classify.objectClass
    • [...redacted...]
    • __proto__: TemplateClass
      • $className: "Ext.Button"
      • [...redacted...]
    calling getText() on that object works as expected.
    I'm using ST2 Beta2.
    Strange, I tried it again and it works. Sorry for not believing you ;-)

    side note: my editor (webstorm) sees getText() as an unresolved function or method.

  9. #8
    Sencha User
    Join Date
    Jan 2012
    Posts
    49
    Answers
    6
    Vote Rating
    0
    j.k is on a distinguished road

      0  

    Default


    Quote Originally Posted by rockinthesixstring View Post
    side note: my editor (webstorm) sees getText() as an unresolved function or method.
    I'm using phpstorm, too. It's saying it's unresolved, because the get/set methods are generated during runtime, and webstorm is not smart enough, yet, to recognize the new class system's config property and the property accessors

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi