-
25 Feb 2011 11:03 PM #1
Dynamic toolbars troubles
Dynamic toolbars troubles
Hello,
I didn't manage to have my toolbar modified dynamically.
So, with this declaration :
I tried these ways :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' }) ] });
Just has no visible effect.Code:ptk.toolbar.add('-');- Note: Even if I use directlyCode:
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();andCode:ptk.viewport.add
This raise an exception in AbstractLayout.js:129 onCode:ptk.viewport.remove
: item.el.dom is undefined.Code:target.insertBefore(item.el.dom, position || null);
-
2 Jun 2012 1:21 PM #2
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
-
Troubles with values on dynamic form editing from grid
By ricardorios in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 1 Dec 2010, 6:28 AM -
Dynamic Toolbars
By mrtedweb in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 10 Jan 2010, 10:54 AM -
ArrayStore troubles
By realjax in forum Ext 3.x: Help & DiscussionReplies: 2Last Post: 19 Nov 2009, 7:09 AM -
Ext Combo Troubles
By don4321 in forum Ext 2.x: Help & DiscussionReplies: 21Last Post: 8 Jul 2009, 4:29 PM


Reply With Quote