0

当我在我的网格中添加一条记录时,使用 POST 命中“创建”url,但在检查 httpd 日志时,POST 参数为空。

这是我的网格和数据源定义:

$(function() {
            $("#grid").kendoGrid({
                dataSource: {
                    transport:{
                        read:"libyMsg.php?way=getUsrMsgList",
                        create:{
                            url :"libyMsg.php?way=createMsg",
                            type:"POST"
                        },
                        update:{
                            url :"libyMsg.php?way=updateeMsg",
                            type:"POST"
                        },
                        destroy:{
                            url :"libyMsg.php?way=destroyMsg",
                            type:"POST"
                        }
                    },
                    batch: true,
                    pageSize: 10,
                    schema: {
                        data: "data",
                        model: {
                            id: "msg_id",
                            fields: {
                                msg_id: { editable: false, nullable: true },
                                msg_title: { validation: { required: true } },
                                msg_content: {  validation: { required: true } },
                                msg_type: { type: "number", validation: { min: 0, required: true }},
                                msg_date: { type: "date", validation: { required: true } },
                                msg_status: { type: "number", validation: { min: 0, required: true } }
                            }
                        }
                    }
                },
                columns: [{ field: "msg_id", width: 40,title: "ID" },
                    { field: "msg_title",width: 230, title: "Title" },
                    { field: "msg_content", width: 370,title: "Content" },
                    { field: "msg_type", width: 40,title: "Type" },
                    { field: "msg_date", width: 300,title: "Date" }, 
                    { field: "msg_status", width: 40,title: "Status" }],
                scrollable: true,
                sortable: true,
                editable:"popup",
                pageable: {
                    refresh: true,
                    pageSizes: true
                },
                toolbar: ["create", "save", "cancel"],
            });
        });

我想知道为什么,当我添加一条新记录时,它实际上是 POST,但没有任何参数。
任何想法?谢谢/M

4

1 回答 1

1

您好,您粘贴的代码运行良好。是一个演示它的 JsBin - 我可以在浏览器的网络选项卡中看到像这样发送的值。

models[0][msg_id]:23
models[0][msg_title]:foo
models[0][msg_content]:bar
models[0][msg_type]:2323
models[0][msg_date]:Sun Nov 25 2012 01:05:03 GMT+0200 (FLE Standard Time)
models[0][msg_status]:563

您尝试在服务器上访问这些值的方式可能不正确。我建议你分享你的服务器代码。

于 2012-11-24T23:09:21.767 回答