简体   繁体   中英

KendoUI Grid/Datasource. When “create”, empty POST request, no parameters

When I add a record in my Grid, "create" url is hit using POST, but checking in the httpd logs, POST parameters are empty.

This is my Grid & Datasource definition:

$(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"],
            });
        });

I wonder why, when i add a new record, it actually POSTs but withouht any parameters.
Any idea? Thanx/M

Hello the code you pasted is working fine. Here is a JsBin which demonstrates it - I can see in the network tab of my browser that the values as send like this.

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

Probably the way you try to access these values on the server is not right. I would suggest you to share your server code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM