-
6 Nov 2012 1:18 PM #1
Unanswered: Problem with toolbar overflow
Unanswered: Problem with toolbar overflow
I'm trying to create an icon only toolbar that supports overflow. However, I've run into two problems when the overflow is triggered:
1) The items in the overflow menu have an icon, but no text. This is expected since I'm just specifying an icon, but how can I have text that displays in just overflow mode?
2) My toolbar buttons are created with scale: medium. The overflow menu wants to use icons that are appropriate to a scale: small button. How can I either bump up the size of the icons or specify different icons of the appropriate size to the overflow menu?
-
6 Nov 2012 4:17 PM #2
Dunno if this is the best way to handle it, but you could listen for the toolbar's overflowchange event and loop through the overflow items and set their text.
So, for each button you could set a config of myText or something and then do:
Code:listeners: { overflowchange: function (lhc, hc, items) { Ext.each(items, function (item) { item.setText(item.myText); }); } }
-
6 Nov 2012 9:46 PM #3Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,103
- Vote Rating
- 97
- Answers
- 171
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
6 Nov 2012 11:22 PM #4
Probably not a great thing to do in case the code changes, but...
http://jsfiddle.net/slemmon/Z9gjq/
BTW, I couldn't find what fired the overflowchange event in the source code. What does that do?Code:Ext.widget('panel', { title: 'Overflow' , renderTo: Ext.getBody() , resizable: true , height: 200 , width: 300 , dockedItems: [{ xtype: 'toolbar' , enableOverflow: true , dock: 'top' , items: [{ icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 1' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 2' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 3' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 4' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 5' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 6' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 7' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 8' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 9' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 10' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 11' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 12' }, { icon: 'http://www.tactilecrm.com/images/tick.png' , myText: 'Item 13' }] , listeners: { afterlayout: { fn: function (t) { var o = t.layout.overflowHandler.menuItems; t.items.each(function (item) { item.setText(); }); Ext.each(o, function (item) { item.setText(item.myText); }); } , buffer: 20 } } }] });Last edited by slemmon; 6 Nov 2012 at 11:34 PM. Reason: formatting code and add jsfiddle url
-
8 Dec 2012 2:29 PM #5
It looks like the overflowchange event is broken (and has been for some time): http://www.sencha.com/forum/showthre...is-never-fired


Reply With Quote