Hi,
I'm trying to accomplish an TreeView Context menu based on a value in the clicked row.
This is the structure of the treeview:
$("#treeview").kendoTreeView({
dataSource: [{
id: 1, text: "Folder", type: "", items: [
{ id: 2, text: "Document 1", type: true },
{ id: 3, text: "Document 2", type: true }
]
}],
template: "<div class='#= item.type #' >#= item.text # </div><input type='hidden' class='data-id' value='#= item.id #' /><input type='hidden' class='type-id' value='#= item.type #' />"
});
I'm using the KendoUI.EX extention (https://github.com/insanio/kendoui.ex) for the contextmenu.
var cm = $('#contextMenu').kendoMenuEx({
dataSource: [
{
text: 'ContextMenu',
click: function (event) {
alert("Clicked ContextMenu");
}
}
],
anchor: '#TreeView li',
delay: 1500
});
I need to have something like this:
contextmenu 1 = "Open 1 document", "Show properties"
contextmenu 2 = "Open all documents"
onContextMenuOpen ->
if type = "document" -> open contextmenu 1
if type = "folder" -> open contextmenu 2
I looked into the events of the treeview and context menu. And there is no event that gets fired between clicking right mouse button and showing the menu.
I hope someone can help me with this, or put me on the right track.
Thanks in advance
Stijn
I'm trying to accomplish an TreeView Context menu based on a value in the clicked row.
This is the structure of the treeview:
$("#treeview").kendoTreeView({
dataSource: [{
id: 1, text: "Folder", type: "", items: [
{ id: 2, text: "Document 1", type: true },
{ id: 3, text: "Document 2", type: true }
]
}],
template: "<div class='#= item.type #' >#= item.text # </div><input type='hidden' class='data-id' value='#= item.id #' /><input type='hidden' class='type-id' value='#= item.type #' />"
});
I'm using the KendoUI.EX extention (https://github.com/insanio/kendoui.ex) for the contextmenu.
var cm = $('#contextMenu').kendoMenuEx({
dataSource: [
{
text: 'ContextMenu',
click: function (event) {
alert("Clicked ContextMenu");
}
}
],
anchor: '#TreeView li',
delay: 1500
});
I need to have something like this:
contextmenu 1 = "Open 1 document", "Show properties"
contextmenu 2 = "Open all documents"
onContextMenuOpen ->
if type = "document" -> open contextmenu 1
if type = "folder" -> open contextmenu 2
I looked into the events of the treeview and context menu. And there is no event that gets fired between clicking right mouse button and showing the menu.
I hope someone can help me with this, or put me on the right track.
Thanks in advance
Stijn