2

Q1 : (servicestack を使用して) restful サービスと通信するデータソースに kendoui グリッドをバインドしようとしています。PUT を呼び出して残りのサービスが永続化された poco オブジェクトを送り返す場合を除いて、すべて正常に動作しています。奇妙な JavaScript エラーが発生し、データソースの成功メソッドに到達しません。

エラーは

Uncaught SyntaxError: Unexpected number kendo.all.min.js:9
extend.setter kendo.all.min.js:9
o.extend._set kendo.all.min.js:9
T.extend.accept kendo.all.min.js:9
o.extend._accept kendo.all.min.js:9
(anonymous function) kendo.all.min.js:9
n jquery.min.js:2
o.fireWith jquery.min.js:2
o.fire jquery.min.js:2
g.(anonymous function).call.c.success kendo.all.min.js:9
n jquery.min.js:2
o.fireWith jquery.min.js:2
w jquery.min.js:4
d

データソース/グリッド構成は次のようになります

$(document).ready(function () {
    var crudServiceBaseUrl = "/api/configuration/databaseconnections";
    $("#grid").kendoGrid({
    dataSource: {
        type: "json",
        transport: {
        read: {
            url: crudServiceBaseUrl,
            dataType: "json"
        },
        update: {
            url: function (db) {
            console.log(db);
            return crudServiceBaseUrl + "/" + db.Id;
            },
            type: "PUT",
            success: function (result) {
            console.log(result);
            }
            //dataType: "json"
        },
        destroy: {
            url: function (db) {
            return crudServiceBaseUrl + "/" + db.Id;
            },
            type: "DELETE",
            //dataType: "json"
        },
        create: {
            url: function (db) {
            return crudServiceBaseUrl + "/" + db.Id;
            },
            type: "PUT",
            //dataType: "json"
        },
        },




        schema: {
        model: {
                id: "Id",
            fields: {
            Id: { type: "string" },
            ConnectionString: { type: "string" },
            DatabaseType: { type: "string" },
            ProfileConnection: { type: "string" },
            }
        }
        },
        pageSize: 10,
        serverPaging: false,
        serverFiltering: false,
        serverSorting: false,
        model: {
        id: "Id",
        fields: {
            ConnectionString: { editable: true },
            DatabaseType: { editable: false, nullable: false, validation: { required: true } },
            ProfileConnection: { editable: false, nullable: false, validation: { required: true } },
        }
        }

    },
    height: 250,
    filterable: true,
    sortable: true,
    pageable: true,
    reorderable: true,
    resizable: true,
    toolbar: ["create"],
    columns: [{
        field: "Id",
        filterable: false,
        width: 150,
    },
        {
        field: "ConnectionString",
        title: "Connection String",
        filterable: false,
        }, {
        field: "DatabaseType",
        title: "Type",
        width: 100
        },
        {
        field: "ProfileConnection",
        title: "Profile",
        width: 100
        },
    { command: ["edit", "destroy"], title: " ", width: "210px" }
    ],
    editable: "popup"
    });
});

Q2 : クラッド レスト サービスで動作する kendoui データソースのアイデアまたはサンプルを持っている人はいますか?

4

1 に答える 1

1

Q1 : コメントで述べたように、問題が見つかりました。(接続文字列の ";")

Q2 : 2 番目の質問については、このサンプル コード ( Binding grid to a Web ApiController ) をダウンロードして確認してください。

于 2013-10-10T14:58:12.847 に答える