-
16 Dec 2010 4:11 PM #1
how to add icons / buttons in a docked panel without using toolbar?
how to add icons / buttons in a docked panel without using toolbar?
Hi,
I want to add a panel in the dockedItems, and include some html text and a couple of icons and buttons.
The following code renders the docked panel with the html text, but the icons/buttons don't show up.
If I use xtype=toolbar or segmentedbutton, then I see the buttons. But I don't want to use toolbar, just a simple docked panel with my own style.Code:dockedItems: [{ xtype: 'panel', dock: 'top', cls: 'myCls', html: 'Some text', items: [{ layout: {pack: 'center'}, //xtype: 'panel', items: [{ iconCls: 'arrow_up', //text:'Previous', ui: 'plain', iconMask: true, handler: function(){} }, { iconCls: 'arrow_down', ui: 'plain', //text:'Next', iconMask: true, handler: function(){} }] }] }]
What am I doing wrong?
Thanks,
Sam
-
30 Sep 2011 10:39 AM #2
Try something like this:
I am doing something similar. I am running into a problem tho. Initially I apply a class "clr" so the buttons do not show up. When certain things happen, I want the buttons to show up and so I remove the class "clr". The problem is that sometimes displaying the button causes the css to be strange and the button appears to the side of the toolbar instead of in it... Anyone have any ideas on how to fix that?Code:dockedItems: [{ xtype: 'panel', dock: 'top', cls: 'myCls', html: 'Some text', dockedItems: [ { xtype: 'button', dock: 'right', iconCls: 'arrow_up', text:'Previous', ui: 'plain', iconMask: true, handler: function(){} }, { xtype: 'button', dock: 'right', iconCls: 'arrow_down', ui: 'plain', text:'Next', iconMask: true, handler: function(){} }] }]
-
30 Sep 2011 1:27 PM #3
I fixed it by running doComponentLayout() on both the main panel and the item that contains the buttons. It wasnt working previously because I was only running doComponentLayout() on the main panel, and not the item directly holding the button
Code:// global paths to items TitleBar = MyApp.Viewport.dockedItems.items[1]; PrevBtn = MyApp.Viewport.dockedItems.items[1].dockedItems.items[1]; NextBtn = MyApp.Viewport.dockedItems.items[1].dockedItems.items[2]; ... // show buttons PrevBtn.removeCls("clr"); NextBtn.removeCls("clr"); // update display so buttons are in the right place //MyApp.Viewport.doComponentLayout(); // this seems to not be needed TitleBar.doComponentLayout();
Similar Threads
-
Can a toolbar inherit the title of panel it's docked to?
By kevinwmerritt in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 10 Dec 2010, 2:11 PM -
Unable to add Docked Panel
By gcallaghan in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 21 Oct 2010, 10:35 AM -
Top docked toolbar does not render inside panel which is inside a fit layout panel
By JacobGu in forum Sencha Touch 1.x: DiscussionReplies: 2Last Post: 23 Aug 2010, 3:31 AM -
Large Icons on Toolbar Buttons
By big_jim in forum Ext 2.x: Help & DiscussionReplies: 12Last Post: 10 Jun 2010, 11:59 AM


Reply With Quote