PDA

View Full Version : Menu icon is not displaying when menu is added dynamically for button



haiphongrv
24 Feb 2017, 12:48 AM
Menu icon is not displaying when menu is added dynamically to button.

Please find the below code


var button1 = Ext.create('Ext.Button', {
text : 'Menu button',
renderTo : Ext.getBody(),
arrowAlign: 'bottom'
});

var menu1 = Ext.create('Ext.menu.Menu',{
items:[{text: 'Item 1'},
{text: 'Item 2'},
{text: 'Item 3'},
{text: 'Item 4'}]
});

button1.menu = menu1;

Gary Schlosberg
24 Feb 2017, 9:03 AM
I think you'd have to declare an empty menu so that the button knows it has a menu when rendered.
https://fiddle.sencha.com/#view/editor&fiddle/1quv