1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    14
    Vote Rating
    0
    masai is on a distinguished road

      0  

    Default how to modify the badgeText

    how to modify the badgeText


    Hi, I really don't understand how to change the badgeText dinamically. I have this simple script:

    PHP Code:
    Ext.setup({
        
    onReady: function() {
            new 
    Ext.TabPanel({
                
    fullscreentrue,
                
    tabBar: {
                    
    dock'bottom',
                    
    layout: {
                        
    pack'center'
                    
    }
                },
                
    items: [{
                    
    title'Fav',
                    
    iconCls'favorites',
                    
    id'myfav',
                    
    badgeText'3'
                
    }]
            });
            
    alert(Ext.getCmp('myfav').badgeText);
            
    Ext.getCmp('myfav').setBadge("5"); // error 
        
    }
    }); 
    I can read the badgeText with the alert, but I can't modify it with setBadge!!
    I receive this error in chrome:
    Uncaught TypeError: Object [object Object] has no method 'setBadge'

    So? can anyone help me to change this badge please ??

    Massimo

  2. #2
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    514
    Vote Rating
    82
    existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice

      0  

    Default


    There may be better ways to do this, but you can start at the tabBar object, and then do something like this to set badge text, based on the index of the tabBar item:

    Code:
    Ext.getCmp('mytabbarid').items.getAt(tabindex).setBadge(whatever...);

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    14
    Vote Rating
    0
    masai is on a distinguished road

      0  

    Default


    It works! Thank you!! (I still don't understand why I can't use getCmp with items ....)

  4. #4
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    514
    Vote Rating
    82
    existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice existdissolve is just really nice

      0  

    Default


    I think it's because the tabBar "items" contains a special MixedCollection of Tabs, which are the objects that have the setBadge() method. When you use getCmp() on the tab itself, you're really just getting the button/panel/whatever that has that id, and these xtypes don't have the setBadge() method.

  5. #5
    Sencha User
    Join Date
    Jan 2011
    Posts
    1
    Vote Rating
    0
    pacman321 is on a distinguished road

      0  

    Default


    I use another solution that works perfectly:

    Code:
    Ext.getCmp('myfav').tab.setBadge('5');
    I hope that it will be useful

  6. #6
    Sencha User
    Join Date
    Jul 2011
    Posts
    3
    Vote Rating
    0
    davidlevy is on a distinguished road

      0  

    Default


    Quote Originally Posted by pacman321 View Post
    I use another solution that works perfectly:

    Code:
    Ext.getCmp('myfav').tab.setBadge('5');
    I hope that it will be useful
    works for me !
    thx !

  7. #7
    Sencha User
    Join Date
    Aug 2012
    Location
    Hyderabad India
    Posts
    20
    Vote Rating
    0
    srinusencha is on a distinguished road

      0  

    Default thanks existdissolve how to modify the badgeText its working for me great answer..

    thanks existdissolve how to modify the badgeText its working for me great answer..


    thanks existdissolve how to modify the badgeText its working for me great answer..

Similar Threads

  1. Dynamic badgeText
    By mcbaker in forum Sencha Touch 1.x: Discussion
    Replies: 5
    Last Post: 13 Sep 2011, 9:48 PM
  2. [1.1.0] badgeText wrong placement when TabBar is docked at top
    By mitchellsimoens in forum Sencha Touch 1.x: Bugs
    Replies: 0
    Last Post: 29 Mar 2011, 11:37 AM
  3. Updaing the badgeText property of a panel
    By Shijutv in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 30 Dec 2010, 5:22 AM
  4. [FIXED-160] badgeText not documented for Button
    By jay@moduscreate.com in forum Sencha Touch 1.x: Bugs
    Replies: 2
    Last Post: 28 Jul 2010, 12:21 PM
  5. Badgetext on any button ?
    By Aldri in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 13 Jul 2010, 10:09 AM

Thread Participants: 4

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar