user990423
user990423

Reputation: 1389

javaScript runtime error: 'kendo' is undefined

I have an application that uses kendo grid, and when I try to run the application, I get this error

JavaScript runtime error: 'kendo' is undefined

Below is my code. Where do I need to define kendo?

<link rel="stylesheet" href="http://cdn.kendostatic.com/2015.2.624/styles/kendo.common.min.css" />
<link rel="stylesheet" href="http://cdn.kendostatic.com/2015.2.624/styles/kendo.default.min.css" />  

<script src="http://cdn.kendostatic.com/2015.2.624/js/jquery.min.js"></script>
<script src="http://cdn.kendostatic.com/2015.2.624/js/kendo.all.min.js"></script>  


<div id="rpViewContent" class="view-content">
    <div id="purchdGrid"
            data-role="grid"
            data-resizable="true"
            data-navigatable="true"
            data-editable="true"
            data-pageable="false"
            data-columns="[
                { 'field': 'PO', 'title': '<b>PO #', 'width': 65 },
                { 'field': 'Line', 'title': '<b>Line #', 'width': 65 },
                { 'field': 'Item', 'title': '<b>Item #', 'width': 65 },
            ]"
            data-bind="source:purchDataSource"
            style="height: 55%">
    </div></div>  
    <script>
        var viewModel = kendo.observable({
            purchDataSource: new kendo.data.DataSource({
                schema: {
                    model: {
                        id: "ID",
                        fields: {
                            Line: { type: "string" },
                            Item: { type: "string" }
                        }
                    }
                },
                data: [
                    { ID: "43824", Line: "1", Item: "Thus is a test 1" },
                    { ID: "43825", Line: "2", Item: "Thus is a test 2" },
                    { ID: "43826", Line: "3", Item: "Thus is a test 3" }
                ]
            })
        });
        kendo.bind($("#purchViewContent"), viewModel);
    </script>

Upvotes: 2

Views: 4974

Answers (1)

NMunro
NMunro

Reputation: 910

This snippet shows a valid Kendo object, ensure your link and script tags are in the correct place in the HTML document.

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="http://cdn.kendostatic.com/2015.2.624/styles/kendo.common.min.css" />
    <link rel="stylesheet" href="http://cdn.kendostatic.com/2015.2.624/styles/kendo.default.min.css" />  
  </head>
  <body>
    <script src="http://cdn.kendostatic.com/2015.2.624/js/jquery.min.js"></script>
    <script src="http://cdn.kendostatic.com/2015.2.624/js/kendo.all.min.js"></script>  
    <script>
      console.log(kendo);
    </script>
  </body>
</html>

Upvotes: 1

Related Questions