PDA

View Full Version : The context menu has problems when GWT upgrade to 2.0



fangning
15 Dec 2009, 12:49 AM
After I upgrade GWT to new 2.0, when I right click in the grid (or tree), the browser's context menu shows, instead of the GXT context menu.

sven
17 Dec 2009, 4:30 PM
Please read the bugforum guidelines and post a working testcase. Moving this to the help forum for now. None of the examples show this (if used correctly).

You will need to prevent the default action:


event.preventDefault();

micgala
28 Dec 2009, 2:52 AM
Well, also none of the examples need to use

event.preventDefault();This example, for instance, does not use it.
http://www.extjs.com/examples/explorer.html#contextmenutree

I am facing the default browser menu even when doing this (IE6):


tree.addListener(Events.ContextMenu, new Listener<TreePanelEvent<ModelData>>() {
public void handleEvent(TreePanelEvent<ModelData> be) {
be.preventDefault();
}
});This is one example that demonstrates the issue (please try on IE6:



public class StartupEntryPoint implements EntryPoint {

/**
* This is the entry point method.
*/
public void onModuleLoad() {

Window window = new Window();
window.setLayout(new FitLayout());
window.setSize(640, 480);

TreeStore<ModelData> store = new TreeStore<ModelData>();

BaseModel model = new BaseModel();
model.set("name", "Test");
store.add(model, false);

TreePanel<ModelData> tree = new TreePanel<ModelData>(store);
tree.setDisplayProperty("name");
tree.setSize(200, 200);

Menu menu = new Menu();
MenuItem item = new MenuItem("Test Item");
menu.add(item);

tree.setContextMenu(menu);

tree.addListener(Events.ContextMenu, new Listener<TreePanelEvent<ModelData>>() {
public void handleEvent(TreePanelEvent<ModelData> be) {
be.preventDefault();
}
});

window.add(tree);

window.show();
}
}
Not sure why the showcase works, thought.

Please verify.

Tks and regards,
Michel.

micgala
8 Jan 2010, 4:32 AM
Did someone check this on IE6 (XP Service Pack 2)?

systao
5 Feb 2010, 7:16 AM
hi,

I'm facing the same problem with GWT 2.0, GXT 2.1.1 and IE8. I have tried with




grid_.addListener(Events.ContextMenu, new Listener<GridEvent>() {
public void handleEvent(GridEvent be) {
be.preventDefault();
...
}
});


and




grid_.addListener(Events.ContextMenu, new Listener<GridEvent>() {
public void handleEvent(GridEvent be) {
be.stopEvent();
...
}
});


but none of the two is working ...

micgala
5 Feb 2010, 7:30 AM
be.preventDefault();

This is the right one... (but for me it doesn't work, as pointed in the test code above - post #3).

Gxt team, that is the third person...

How about, please, checking this?
I have the same issue on ie6, 7 and 8.

Regards,
Michel.

systao
5 Feb 2010, 7:46 AM
hi,

In another post
http://www.extjs.com/forum/showthread.php?t=83907&highlight=preventDefault%28%29 they explain a way to disable browser contextual menu, but I think this is not the right way of doing it...

Pep.

fangning
5 Feb 2010, 4:52 PM
This problem only exists in DevModel.

micgala
3 Mar 2010, 6:15 AM
It seems this will be fixed for 2.1.2:

http://www.extjs.com/forum/showthread.php?t=88078