Animal
30 Dec 2008, 3:55 AM
For example the contextmenu event.
We may need to catch it just when clicking on the DataView's Element, not necessarily on one of the items.
This is the way the context menu works on Windows explorer in icon view. If you right click on an item, you get "Cut" and "Copy". If you right click on an empty part of the view, you just get the "Paste" enable if you already have something in the clipboard.
This is exactly what I am facing. Right clicking on a DataView to perform overall DataView operations as well as operations on individual nodes.
So for example the context menu event should be handled thus:
Ext.override(Ext.DataView, {
onContextMenu : function(e){
var item = e.getTarget(this.itemSelector, this.el);
// 3.0 code var item = e.getTarget(this.itemSelector, this.getTemplateTarget());
this.fireEvent("contextmenu", this, item ? this.indexOf(item) : -1, item, e);
}
});
The consumer of this event must be aware that the user might not have clicked on a node.
With selected nodes: http://i131.photobucket.com/albums/p286/TimeTrialAnimal/contextmenuselection.jpg
Between nodes with no selected nodes to delete/cut/copy/download:
http://i131.photobucket.com/albums/p286/TimeTrialAnimal/contextmenunoselection.jpg
We may need to catch it just when clicking on the DataView's Element, not necessarily on one of the items.
This is the way the context menu works on Windows explorer in icon view. If you right click on an item, you get "Cut" and "Copy". If you right click on an empty part of the view, you just get the "Paste" enable if you already have something in the clipboard.
This is exactly what I am facing. Right clicking on a DataView to perform overall DataView operations as well as operations on individual nodes.
So for example the context menu event should be handled thus:
Ext.override(Ext.DataView, {
onContextMenu : function(e){
var item = e.getTarget(this.itemSelector, this.el);
// 3.0 code var item = e.getTarget(this.itemSelector, this.getTemplateTarget());
this.fireEvent("contextmenu", this, item ? this.indexOf(item) : -1, item, e);
}
});
The consumer of this event must be aware that the user might not have clicked on a node.
With selected nodes: http://i131.photobucket.com/albums/p286/TimeTrialAnimal/contextmenuselection.jpg
Between nodes with no selected nodes to delete/cut/copy/download:
http://i131.photobucket.com/albums/p286/TimeTrialAnimal/contextmenunoselection.jpg