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

kendoContextMenu is not a function Error

2 Answers 586 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 03 Aug 2016, 05:36 AM

I've been trying to add a Context Menu to a TreeView using this example.

The tree displays fine but the menu code generates an error: $(....).kendoContextMenu is not a function.

JS files included: 

<script src="/Scripts/jquery-1.10.2.js"></script>
<script src="/Scripts/bootstrap.min.js"></script>
<script src="/Scripts/kendo/kendo.all.min.js"></script>
<script src="/Scripts/kendo/kendo.aspnetmvc.min.js"></script>

TreeView and menu:

<ul id='tree'>
            <li id="11">Item1
                <ul>
                    <li id="1">Item1.1</li>
                    <li id="2">Item1.2 </li>
                    <li id="3">Item1.3 </li>
                </ul>
            </li>
            <li id="4">Item2</li>
            <li id="5">Item3</li>
</ul>

<ul id="menu">
        <li>CREATE</li>
        <li>DELETE</li>
</ul>

JS code:

 $("#tree").kendoTreeView(
{
      select: function(event) {
            var $item = $(event.node);
            var id = $item.attr('id');
      }
});

$("#menu").kendoContextMenu({
                        // listen to right-clicks on treeview container
                        target: "#tree",

                        // show when node text is clicked
                        filter: ".k-in",

                        // handle item clicks
                        select: function(e) {
                            var button = $(e.item);
                            var node = $(e.target);
                            alert(kendo.format("'{0}' button clicked on '{1}' node", button.text(), node.text()));
                        }
                    });

Thanks,

Bill

2 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 04 Aug 2016, 11:19 AM
Hello Bill,

I tried to reproduce the issue, but the provided code works as expected:

http://dojo.telerik.com/ozABE/3

Can you please modify it until the error is reproduced, or send us a similar isolated runnable project where it can be observed, so we can inspect what might be causing it?

Thank you in advance.

Regards,
Dimiter Topalov
Telerik by Progress
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
0
Bill
Top achievements
Rank 1
answered on 05 Aug 2016, 03:44 AM

Hi Dimiter,

Thank you for your replay.

I've found the cause of my problem. I've included a wrong kendo.all.min.js file (older version) in my project.

Regards,

Bill

Tags
Menu
Asked by
Bill
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Bill
Top achievements
Rank 1
Share this question
or