1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    47
    Vote Rating
    1
    eddow is on a distinguished road

      0  

    Default Dynamic toolbars troubles

    Dynamic toolbars troubles


    Hello,

    I didn't manage to have my toolbar modified dynamically.

    So, with this declaration :
    Code:
    			ptk.viewport = new Ext.container.Viewport({
    				layout: 'border',
    				items: [
    			        ptk.page = new Ext.panel.Panel({
    						layout: 'fit',
    						region: 'center'
    					}),
    	                ptk.statusBar = new Ext.toolbar.Toolbar({
    		                height: 26,
    		                border: false,
    		                margins: '0',
    		                region: 'south'
    			        }),
    			        ptk.toolbar = new Ext.toolbar.Toolbar({
    		                height: 26,
    		                border: false,
    		                margins: '0',
    		                region: 'north'
    		            })
    			    ]
    			});
    I tried these ways :

    1. Code:
      ptk.toolbar.add('-');
      Just has no visible effect.
    2. Code:
      			ptk.viewport.items.remove(ptk.toolbar);
      			ptk.toolbar.destroy();
      			ptk.toolbar = new Ext.toolbar.Toolbar({
      		                height: 26,
      		                border: false,
      		                margins: '0',
      		                region: 'north',
      		                items: ['-']
      		            });
      			ptk.viewport.items.add(ptk.toolbar);
      			ptk.viewport.doLayout();
      Note: Even if I use directly
      Code:
      ptk.viewport.add
      and
      Code:
      ptk.viewport.remove
      This raise an exception in AbstractLayout.js:129 on
      Code:
      target.insertBefore(item.el.dom, position || null);
      : item.el.dom is undefined.

  2. #2
    Sencha User pavel.psycho.kurnosov's Avatar
    Join Date
    Apr 2012
    Location
    Belarus
    Posts
    9
    Vote Rating
    0
    pavel.psycho.kurnosov is on a distinguished road

      0  

    Default


    You don't have to remove all items for clean toolbar. I create sample based on your code - hope it's will help you:


    Code:
    Ext.onReady(function () {
        Ext.require('Ext.window.Window');
    
    
        var statusBar = new Ext.toolbar.Toolbar({
            height: 26,
            border: false,
            margins: '0',
            region: 'south'
        });
        var toolbar = new Ext.toolbar.Toolbar({
            height: 26,
            border: false,
            margins: '0',
            region: 'north'
        });
    
        var win = Ext.create('Ext.window.Window', {
            title: 'Hello',
            height: 200,
            width: 400,
            layout: 'fit',
            items: [
                statusBar, toolbar
            ]}).show();
    
        //dynamic new add
        statusBar.add('-');
        statusBar.add({text: 'add more',
            handler: function () {
                statusBar.add('-');
                statusBar.add({text: 'name'});
            }});
        statusBar.add({text: 'clear all',
            handler: function () {
                statusBar.removeAll();
            }});
    });
    With best regards,
    Pavel

Similar Threads

  1. Troubles with values on dynamic form editing from grid
    By ricardorios in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 1 Dec 2010, 6:28 AM
  2. Dynamic Toolbars
    By mrtedweb in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 10 Jan 2010, 10:54 AM
  3. ArrayStore troubles
    By realjax in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 19 Nov 2009, 7:09 AM
  4. Ext Combo Troubles
    By don4321 in forum Ext 2.x: Help & Discussion
    Replies: 21
    Last Post: 8 Jul 2009, 4:29 PM

Thread Participants: 1