add context menu to a dataview

Hi.
What is the best way to add context menu to a dataview?

Like in Windows application, on mouse right-click
[]the relevant dataview item should be selected
[
]open the context menu

Best Regards, alon.

That’s what I came with…

[code]
var _dataViewCtxMenu = new dhtmlXMenuObject();

_dataViewCtxMenu.renderAsContextMenu();
_dataViewCtxMenu.loadXMLString('<menu>' + ... + '</menu>');

_dataViewCtxMenu.attachEvent('onClick', function(id, zoneId, casState) {
	var myObj = _dataView.get(_dataView.contextID);
	alert('onClick');
});

_dataView.attachEvent("onBeforeContextMenu", function(itemId, e) {
	if (this.isSelected(itemId)) {
		this.contextID = itemId;
		_dataViewCtxMenu.showContextMenu(e.clientX, e.clientY);
	}
	return false;
});[/code]