-
10 Jul 2009 1:26 AM #1
How to insert an item(button) between...
How to insert an item(button) between...
How to insert an item(button) between two items(buttons) at the panel.toolbar??
I need to insert an item between items at toolbar after items made.
I searched for a while...
there was no solution...
I know there is a way to solve this problem but likeCode:items:[{ text: 'Home', iconCls: 'silk-application-home', handler: function() { alert('clicked Home button'); } // HERE },'-',{ text: 'Logout', iconCls: 'silk-user-go', handler: function() { alert('Clicked Logout button'); } }]
make that invisible first... pop that later by flag
but I want to make that like... add() or extend()... after they made
let me know the solution of this problem...
-
16 Jul 2009 3:08 PM #2
toolbar.insertButton(index, item)
-
16 Jul 2009 3:10 PM #3
Sorry, that code is for Ext3.0. For 2.2 you would have to do something like:
This should work for butttons aswell as fields...Code:Ext.override(Ext.Toolbar, { insertField : function(index,field){ var td = document.createElement("td"); this.tr.insertBefore(td, this.tr.childNodes[index]); this.initMenuTracking(field); field.render(td); this.items.insert(index, field); return field; } })
-
16 Jul 2009 4:36 PM #4
You should just be able to use the normal container method insert() ... very similar to insertButton().
Don't forget you may need to call doLayout() afterwards.MJ
API Search || Ext 3: docs-demo-upgrade guide || User Extension Repository
Frequently Asked Questions: FAQs
Tutorial: Grid (php/mysql/json) , Application Design and Structure || Extensions: MetaGrid, MessageWindow
-
16 Jul 2009 5:34 PM #5
Thanks~!!!
Thanks~!!!
I'm using 3.0
so I tried the first method..
That works well enough...Code:insertButton(index, items);
Let me see what I did before...
very simple... but messy...
Thanks again for your help guys...Code:var logout = Ext.getCmp('logout'); // is this method to get the component is good? toolbar.remove(logout); toolbar.addItem([ { text: 'Administrator', tooltip: 'Changing mode to admin', iconCls: 'silk-arrow-refresh', handler: function(){ alert('Clicked Administrator button'); } },'-',{ text: 'Logout', id:'logout', tooltip : 'Log out from this session.', iconCls: 'silk-user-go', handler: function() { alert('Clicked Logout button'); } } ]);


Reply With Quote