PDA

View Full Version : Menu width - IE inline style



seclar
15 Dec 2010, 5:38 AM
Hi,

I'm not much of a client-side person, so bit stuck debugging this.

I have a right-click context menu:

IE:

<DIV style="Z-INDEX: 15000; POSITION: absolute; WIDTH: 114px; VISIBILITY: visible; TOP: 181px; LEFT: 99px" id=ext-gen198 class="x-layer x-menu" jQuery1292419480000="30">

Firefox:

<div class="x-layer x-menu" id="ext-gen199" style="position: absolute; z-index: 15000; visibility: visible; left: 102px; top: 177px;">

You can see that the IE(8) version has a width applied via an inline style. That width isn't wide enough for one of my menu items. Where do I look for this? 'fgrep -r 114' isn't helping.

Thanks,

Edit: I know that's a bit vague, but I'm hoping someone can point me to a place in the code where "that kind of thing" happens. It's only happening for IE, so something is *trying* to do the right thing and getting it wrong.

seclar
16 Dec 2010, 1:09 AM
/bump.

If the question's nonsense perhaps someone could say that. I'll provide whatever other information I can. At the moment it looks like extjs is deciding to apply additional styles for IE8 and getting it wrong. I'm happy to be proven wrong on this.

mankz
16 Dec 2010, 1:30 AM
Could you post the Menu code you're using to show your menu?

seclar
16 Dec 2010, 1:36 AM
Hi, thanks. I believe this is the bit you're after. This wasn't written by me, unfortunately, I've just inherited responsibility for it.


function show(json, point, handlers) {
if(!menu) { // create context menu on first right click
menu = new Ext.menu.Menu({
shadow: false
});
}
menu.hide();

if (typeof(json) != 'undefined'
&& typeof(json['items']) != 'undefined'
&& json.items.length > 0) {
var i = 0;
for(; i < json.items.length; i++) {
var j = i * 2;
var menuItem;
var sepItem;
if (j < menu.items.getCount()) {
menuItem = menu.items.get(j);
sepItem = menu.items.get(j + 1);
} else {
menuItem = new Ext.menu.Item();
sepItem = new Ext.menu.Separator();
menu.addItem(menuItem);
menu.addItem(sepItem);
}
menuItem.setText(json.items[i].text);
if (json.items[i]['default']) {
menuItem.addClass('nav-menu-item-default');
} else {
menuItem.removeClass('nav-menu-item-default');
}
if (typeof(json.items[i]['icon']) == 'undefined') {
menuItem.setIconClass(null);
} else {
menuItem.setIconClass(json.items[i].icon);
}
if (handlers != null && typeof(handlers[json.items[i].handler]) != 'undefined') {
var params = handlers[json.items[i].handler];
menuItem.setHandler(params.handler, params.scope);
sepItem.hide();
menuItem.show();
} else if (json.items[i].handler == 'separator') {
menuItem.hide();
sepItem.show();
} else if (typeof(ME.handlers[json.items[i].handler]) != 'undefined') {
menuItem.setHandler(ME.handlers[json.items[i].handler].handler);
ME.handlers[json.items[i].handler].setHandlerParams(menuItem, json.items[i]);
sepItem.hide();
menuItem.show();
} else {
sepItem.hide();
menuItem.hide();
}
}
for(j = i * 2; j < menu.items.getCount(); j++) {
menu.items.get(j).hide();
}
menu.showAt(point);
}
}

seclar
20 Dec 2010, 1:20 AM
/bump

seclar
4 Jan 2011, 12:51 AM
/bump