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

$document is undefined??

2 Answers 147 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Software
Top achievements
Rank 1
Software asked on 02 Jan 2013, 10:55 PM
I'm just getting around to trying out Kendo UI Web for the first time, and I've run into an error that I didn't expect, and can't see why it's coming up...  I created a Kendo UI/MVC 4 project, added a couple Views to the Home controller and on the List View I added a Kendo Grid.  When I run the page I get this error in the debugger:

Microsoft JScript runtime error: '$document' is undefined

What?  Crazy, right?  I have jquery.min.js correctly referenced in my _Layout.cshtml file, and confirmed it's loaded when the site runs.  So where is this error coming from and how do I fix it?  I am binding the grid to my model, which is an IEnumerable, and if I bind it to a table in the SAME VIEW, it works beautifully.  So the data is good.

Here's the code I'm using in the View:
<div id="container">
    <div id="grid"></div>
    <script>
        $document.ready(function() {
            $("#grid").kendoGrid({
                id: "gridList",
                dataSource: model,
                schema: {
                    model: {
                        fields: {
                            IncidentType: { type: "string" },
                            Location: { type: "string" },
                            WatchDateTime: { type: "date" },
                            PostDateTime: { type: "date" }                           
                        }
                    },
                    pageSize: 10
                },
                height: 600,
                scrollable: true,
                sortable: true,
                pageable: { input: true, numeric: false },
                columns: [
                    {
                        field: "IncidentType",
                        title: "Incident Type",
                        width: 300
                    },
                    {
                        field: "Location",
                        title: "Location",
                        width: 100
                    },
                    {
                        field: "WatchDateTime",
                        title: "Incident Date",
                        width: 100
                    },
                    {
                        field: "PostDateTime",
                        title: "Post Date",
                        width: 100
                    }
                ]
            });
        });
    </script>
</div>
Any ideas?  I'd love to get started using Kendo, if I can get past this initial issue...

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 03 Jan 2013, 07:32 AM
Hi Eddie,

 The correct syntax is $(document).ready not $document.ready. Did you found the incorrect $document statement somewhere in our documentation or examples? We would really like to fix that.

All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Software
Top achievements
Rank 1
answered on 03 Jan 2013, 03:41 PM
Hi Atanas,

Nope, that was my typo.  Thanks for pointing it out, everything is working now, of course.

Eddie
Tags
General Discussions
Asked by
Software
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Software
Top achievements
Rank 1
Share this question
or