1. #1
    Ext User
    Join Date
    Nov 2007
    Posts
    7
    Vote Rating
    0
    aleks_raiden is on a distinguished road

      0  

    Question Dinamicly add buttons at toolbar

    Dinamicly add buttons at toolbar


    Hi,

    I trying to create own interface based on toolbars. Its docked by top, and if i click to other button, i try to add another button to toolbar. But i cant this, only removeAll and setTitle are working. If i try to use insert function (or another, e.g., add/addButton etc), in console: TypeError: Result of expression 'c' [undefined] is not an object. (at line 13711 in ext-debug). How i can dinamicly adding new button to toolbar?

    Code:
    new Ext.Panel({	fullscreen: true,
    			id: 'content',
    			scroll: 'vertical',
    			dockedItems: [{
    						xtype: 'toolbar',
    						dock: 'top',
    						id: 'main_page_topbar',
    						title: 'Новости',
    						defaults: {
    								ui: 'mask'
    						},
    						scroll: 'horizontal',
    						items: [{									
    								iconCls: 'refresh'
    							},{
    								text: 'XMLHTTP',
    								xtype: 'button'									
    						}]
    					},
    ...
    
    //and try to add button
    
    var tBar = Ext.getCmp('main_page_topbar');
         tBar.removeAll(true);
         tBar.setTitle('Карта');
         tBar.insert({iconCls: 'maps'}); // error at this line, if commented, all OK
    												
         tBar.doLayout();

  2. #2
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243
    Vote Rating
    7
    TommyMaintz will become famous soon enough

      0  

    Default


    Insert expects the position that you want to insert the item to as its first argument. tBar.insert(0, {iconCls: 'map'}). In your case since there are no items in the toolbar, you could just call tBar.add({iconCls: 'map'});

Similar Threads

  1. Dynamically add Buttons/Text to Toolbar
    By gizmo1177 in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 2 Oct 2009, 5:38 AM
  2. How to add buttons individuallly to a toolbar
    By Maxrunner in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 6 Jul 2009, 4:39 AM
  3. *newbie* Can't add toolbar buttons to Treepanel
    By noso in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 3 Oct 2008, 1:38 AM

Thread Participants: 1

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