グリッドの基本機能を実装しようとしています。プロジェクトのコンパイル中に、「オブジェクトが必要です」というエラーが表示されます。</ p>
以下のコード行で:
         $(document).ready(function() {
                $("#grid").kendoGrid({
                    dataSource: {
                        data: createRandomData(50),  //exception in this line of code
                        pageSize: 10
                    },
createRandomDataの代わりに何を書く必要があるかを理解するのを手伝ってもらえますか?グリッドに配置するためにデータを取得しているテーブル名ですか、それとも別の名前ですか?(ところで、私はバックエンドとしてSQL Server 2008を使用しており、このコードをVisual Studio 2010 MVC4で実行しています)。MVCとKendoUIも初めてです。
私が実装しようとしているのは、MVC4を使用してSQLサーバーからグリッドにデータをバインドすることです。
前もって感謝します!:)
コードは次のとおりです。
              <script>
            $(document).ready(function () {
                $("#grid").kendoGrid({
                    dataSource: {
                        data: createRandomData(50),
                        pageSize: 10
                    },
                    groupable: true,
                    sortable: true,
                    pageable: {
                        refresh: true,
                        pageSizes: true
                    },
                    columns: [{
                        field: "FirstName",
                        width: 90,
                        title: "First Name"
                    }, {
                        field: "LastName",
                        width: 90,
                        title: "Last Name"
                    }, {
                        width: 100,
                        field: "City"
                    }, {
                        field: "Title"
                    }, {
                        field: "BirthDate",
                        title: "Birth Date",
                        template: '#= kendo.toString(BirthDate,"dd MMMM yyyy") #'
                    }, {
                        width: 50,
                        field: "Age"
                    }
                    ]
                });
            });
        </script>
関数の定義は次のとおりです。
    function createRandomData(count) {
       var data = [],
      now = new Date();
       for (var i = 0; i < count; i++) {
        var firstName = firstNames[Math.floor(Math.random() * firstNames.length)],
        lastName = lastNames[Math.floor(Math.random() * lastNames.length)],
        city = cities[Math.floor(Math.random() * cities.length)],
        title = titles[Math.floor(Math.random() * titles.length)],
        birthDate = birthDates[Math.floor(Math.random() * birthDates.length)],
        age = now.getFullYear() - birthDate.getFullYear();
    data.push({
        Id: i + 1,
        FirstName: firstName,
        LastName: lastName,
        City: city,
        Title: title,
        BirthDate: birthDate,
        Age: age
    });
}
return data;
}
コントローラは、渡された値をカウントとして返す必要がありますか?
    public ActionResult createRandomData()
    {
       return View();
    }