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

Can't seem to get grid to display data

2 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 2
Richard asked on 22 Nov 2011, 04:30 AM
I have been trying to get a simple Kendo project to work and finally decided to post here for some help.

Here is my code:

<!DOCTYPE html>

<html>

<head>

    <title></title>

    <link href="kendo.common.min.css" rel="stylesheet" />

    <link href="kendo.kendo.min.css" rel="stylesheet" />

    <script src="js/jquery-1.6.2.min.js"></script>

    <script src="js/kendo.all.min.js"></script>

    <style>

        .contain {

            width: 800px;

            height: auto;

        }

    </style>

</head>

<body>

    <div id="container" class="contain">

        <div id="grid"></div>

        

    </div>

    <script>

        $(document).ready(function () {

            var source = [

                            {

                                "firstname": "Richard",

                                "lastname": "Rostant"

                            },

                            {

                                "firstname": "John",

                                "lastname": "Smith"

                            },

                            {

                                "firstname": "Harry",

                                "lastname": "Summers"

                            },

                            {

                                "firstname": "Henry",

                                "lastname": "Ford"

                            }

                         ];

            var ndataSource = new kendo.data.DataSource({ data: source });

            

            $("#grid").kendoGrid({

                datasource: ndataSource,

                columns: [

                                {

                                    field: "firstname",

                                    title: "First Name"

                                },

                                {

                                    field: "lastname",

                                    title: "Last Name"

                                }

                          ],

                height: 600

            });

        });

    </script>

</body>

</html>

I can't seem to get the grid to display anything. It renders, but no data is being displayed. I am sure that it is something simple that is just eluding me. 

Any help would be appreciated.

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 22 Nov 2011, 10:05 AM
Hello Richard,

It seems that you have misspelled the dataSource option of the grid. It is case-sensitive thus it should be dataSource not datasource.

Best wishes,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Richard
Top achievements
Rank 2
answered on 22 Nov 2011, 04:34 PM
Rosen,

Thanks so much. I knew wit was probably something simple. I'll  give that a shot.
Tags
Grid
Asked by
Richard
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Richard
Top achievements
Rank 2
Share this question
or