PDA

View Full Version : [CLOSED] [2.0] TreePanel Context Menu Issue



markrgli
16 Jul 2009, 6:18 PM
Hi guys,

It's kinda weird but in IE8, when a TreePanel's context menu contains more than two (2) items, the context menu "flickers" (appears and immediately disappears) when you try to open it.

To test, I just copied the code in the Context Menu Tree demo and added one Menu Item to the context menu.

Can anyone confirm this?

The context menu in the Context Menu Tree demo contains only two items.

Browser: IE8 (works fine in IE6, FF, and hosted mode)
GXT: 2.0
GWT: 1.6.4
OS: Windows XP

Thanks in advance.

sven
17 Jul 2009, 2:40 AM
I cant reproduce, also not on the examples. Please post a working testcase as descripbed in the bug forum guidelines.

markrgli
17 Jul 2009, 9:40 PM
Thanks for looking, sven. Below is my test code. Here's the full version number of IE I'm using, if it helps: 8.0.6001.18702.

I'm hope it's just something in my IE browser that's causing this.

Thanks a lot.



import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.store.TreeStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class TreeContextMenuTest implements EntryPoint {

@Override
public void onModuleLoad() {
LayoutContainer panel = createTree();
panel.setWidth(300);
panel.setHeight(500);

// Host HTML file contains div element named 'app'
RootPanel.get("app").add(panel);
}

LayoutContainer createTree() {
ContentPanel panel = new ContentPanel();
panel.setLayout(new FitLayout());

TreeStore<BaseModelData> store = new TreeStore<BaseModelData>();
for (int i = 0; i < 3; i++) {
BaseModelData m = new BaseModelData();
m.set("text", "Root" + i);
store.add(m, false);
for (int j = 0; j < 3; j++) {
BaseModelData n = new BaseModelData();
n.set("text", "Child" + j);
store.add(m, n, false);
}
}
TreePanel<BaseModelData> tree = new TreePanel<BaseModelData>(store);
tree.setDisplayProperty("text");

Menu menu = new Menu();

final MenuItem newItem = new MenuItem("New");
menu.add(newItem);

final MenuItem editItem = new MenuItem("Edit");
menu.add(editItem);

// When dupItem and delItem are not added, context menu works fine
final MenuItem dupItem = new MenuItem("Duplicate");
menu.add(dupItem);

final MenuItem delItem = new MenuItem("Delete");
menu.add(delItem);

tree.setContextMenu(menu);

// Added this code to make the test case as close as possible to my application.
// However, regardless of whether this code is commented out or not, the problem occurs.
// tree.addListener(Events.ContextMenu, new Listener<TreePanelEvent<BaseModelData>>() {
// @Override
// public void handleEvent(TreePanelEvent<BaseModelData> be) {
// BaseModelData m = be.getItem();
// if (((String)m.get("text")).startsWith("Root")) {
// newItem.enable();
// editItem.disable();
// dupItem.disable();
// delItem.disable();
// } else {
// newItem.enable();
// editItem.enable();
// dupItem.enable();
// delItem.enable();
// }
// }
// });

panel.add(tree);

return panel;
}

}

sven
18 Jul 2009, 1:47 AM
Works fine for me. I let this open to see if someone else has the same problem.

Make sure you use GWT 1.7 if testing against IE8

markrgli
30 Jul 2009, 11:24 PM
Just to update, I downloaded GWT 1.7 and GXT 2.0.1 and so far the problem has not been occurring.

sven
30 Jul 2009, 11:31 PM
ok, marking this as closed than.

markrgli
31 Jul 2009, 12:15 AM
Thanks, sven.