Results 1 to 3 of 3

Thread: Need to enable/disable buttons in same Toolbar

  1. #1

    Default Need to enable/disable buttons in same Toolbar

    Hello @ all!

    Im working on a presentation for the iPad.

    I'm new to Sencha Touch but I had managed to program the things i needed until this point:

    I have to enable/disable Buttons within one Toolbar:

    Code:
    var tbar = new Ext.Toolbar({
              dock:'bottom',
    		  xtype: 'toolbar',
    		  cls: 'cntr',
    		  items: [{
                        text: 'Startseite',
                        handler: function(){
                            var car = panel.getComponent(carousel); 
                            car.setCard(0, 'slide');
                        }
                    },{
                        text: 'page 1',
                        handler: function(){
                          var car = panel.getComponent(carousel); 
                            car.setCard(1, 'slide');
    
    
                           // this button should activate the 'stats'-button :-/
    
    
                        }
    		},{
                        text: 'page 2',
                        handler: function(){
                           var car = panel.getComponent(carousel); 
                            car.setCard(2, 'slide');
                        }
    		},{
                        text: 'page 3',
                        handler: function(){
                            var car = panel.getComponent(carousel); 
                            car.setCard(3, 'slide');
                        }
    		},{
    			cls: 'space',
                    },{
    			text: 'Infos',
    			handler: getinfo,
    			cls: 'infos',
    			disabled: true
    		},{
    			text: 'Stats',
    			handler: getstats,
    			cls: 'infos',
    			disabled: true
    	         }]
            });
    I had tried something like:

    var mybutton = panel.getComponent(tbar).getItems();

    but i have no idea how to get the 'stats'-button to set him activ with:

    mybutton.setDisabled(false);

    pls help

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

    Default

    Give the stats button an itemId,

    Code:
    itemId: 'stats'
    
    //
    var button = tbar.getComponent('stats');
    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

    thanks a lot!

    here my code:

    Code:
    var tbar = new Ext.Toolbar({
    			itemId: 'bar',
              dock:'bottom',
    		  xtype: 'toolbar',
    		  cls: 'cntr',
    		  items: [{	
                        text: 'Startseite',
                        handler: function(){
                            var car = panel.getComponent(carousel); 
                            car.setCard(0, 'slide');
    						var btn = tbar.getComponent('stats');
    						btn.setDisabled(false);
                        }
                    },{
                        text: 'Seite 1',
                        handler: function(){
                          var car = panel.getComponent(carousel); 
                            car.setCard(1, 'slide');
                        }
    				},{
                        text: 'Seite 2',
                        handler: function(){
                           var car = panel.getComponent(carousel); 
                            car.setCard(2, 'slide');
                        }
    				},{
                        text: 'Seite 3',
                        handler: function(){
                            var car = panel.getComponent(carousel); 
                            car.setCard(3, 'slide');
                        }
    				},{
    					cls: 'space',
                    },{
    					itemId: 'info',
    					text: 'Infos',
    					handler: getinfo,
    					cls: 'infos',
    					disabled: true,
    				},{
    					itemId: 'stats',
    					text: 'Stats',
    					handler: getstats,
    					cls: 'infos',
    					disabled: true,
    				}]
            });
    ... still work'n on it^^

Similar Threads

  1. Enable/Disable Buttons under IE
    By cupakob in forum Ext GWT: Discussion
    Replies: 5
    Last Post: 13 Jul 2010, 9:42 AM
  2. Howto enable/disable toolbar buttons
    By 100-IT in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 9 Jun 2008, 5:11 AM
  3. Toolbar Button enable/disable support for grayed buttons
    By Choleriker in forum Community Discussion
    Replies: 3
    Last Post: 13 Dec 2006, 10:42 AM

Posting Permissions

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