PDA

View Full Version : [FIXED]Menu Item does not respect cls property



steffenk
18 Mar 2011, 2:45 AM
look here:
http://localhost/ext4/examples/form/form-grid.html

when you call a header menu, there are no icons displayed. Inspecting the image tag they are base64 encoded now, but doesn't work. Example:

<img class="x-menu-item-icon " src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" id="ext-gen1123">

kaigan
18 Mar 2011, 4:03 AM
data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==

is Ext.BLANK_IMAGE_URL, icons in menus are supposed to come from the cls/css

steffenk
18 Mar 2011, 4:24 AM
ok, but how should it work? There is no identifier class, the link now has class
x-menu-item-link

Compare to Ext3 the link was
x-menu-item xg-hmenu-sort-asc

steffenk
19 Mar 2011, 4:05 AM
looking to the source, the classes are set

menuItems.unshift({
itemId: 'ascItem',
text: me.sortAscText,
cls: 'xg-hmenu-sort-asc',
handler: me.onSortAscClick,
scope: me
},{
itemId: 'descItem',
text: me.sortDescText,
cls: 'xg-hmenu-sort-desc',
handler: me.onSortDescClick,
scope: me
},'-');

so the bug is in menu render, cls isn't applied.

steffenk
19 Mar 2011, 5:12 AM
and here is the fix - simply forgotten cls property in Ext.menu.Item:


initComponent: function() {
var me = this,
prefix = Ext.baseCSSPrefix;

me.addEvents(
/**
* @event activate
* Fires when this item is activated
* @param {Ext.menu.Item} item The activated item
*/
'activate',

/**
* @event click
* Fires when this item is clicked
* @param {Ext.menu.Item} item The item that was clicked
* @param {Ext.EventObject} e The underyling {@link Ext.EventObject}.
*/
'click',

/**
* @event deactivate
* Fires when this tiem is deactivated
* @param {Ext.menu.Item} item The deactivated item
*/
'deactivate'
);

var cls = [prefix + 'menu-item'];

if (me.plain) {
cls.push(prefix + 'menu-item-plain');
}

if (me.cls) {
cls.push(me.cls);
}

me.cls = cls.join(' ');

if (me.menu) {
me.menu = Ext.menu.MenuManager.get(me.menu);
}

me.callParent(arguments);
},

evant
20 Mar 2011, 4:42 PM
Indeed. Fixed!