Does it make sense to add an contextmenu eventhandler to layout cell?
I think it would make some things easier?
Could you explain this behaviour, please?
“ui” handles a 1C layout cell with a dataview:
ui.cells("a").dataview = ui.cells("a").attachDataView();
Then i add a context menu to document.body which i would prefer to have for dataview body.
ui.cells("a").context = new dhtmlXMenuObject(document.body);
ui.cells("a").context.setIconsPath("ui/icons/");
ui.cells("a").context.renderAsContextMenu();
ui.cells("a").context.addNewChild("1", "", "1", "New");
ui.cells("a").context.attachEvent("onClick", function(id) {
window.execute(id);
});
Then i could do following in example:
ui.cells("a").dataview.attachEvent("onBodyContextMenu", function() { ui.cells("a").dataview.unselectAll(); })
Or:
ui.cells("a").attachEvent("onBodyContextMenu", function() { ui.cells("a").dataview.unselectAll(); })
Ah, now i see
To set context menu to the cell’s inner div you need to use
ui.cells("a").context = new dhtmlXMenuObject(ui.cells("a").cell)
Cool.
Thanks very much again!
You are welcome!