This is a migrated thread and some comments may be shown as answers.

TreeView ContextMenu based on clicked row

1 Answer 105 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Stijn
Top achievements
Rank 1
Stijn asked on 09 Aug 2013, 12:23 PM
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

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 13 Aug 2013, 08:33 AM
Hi Stijn,

Your question is out of the scope of our standard support services.

The standard support services - the ones included in the support package that goes with the controls, cover only the built-in functionality of the corresponding products. Context menu that you use is a custom extension developed by one of our users.

These extensions are not officially supported by the Kendo UI team. Any support requests (via tickets or Forum posts) should go to either StackOverflow, or to the issues list for that project.

Thank you in advance for the understanding.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Stijn
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or