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

Data not being posted to server

0 Answers 53 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 2
Daniel asked on 20 Sep 2012, 01:02 PM
I can't seem to get any data from the server in the request.parts after specifying method="Post"  and
contenttype="multipart/form-data"

<html>
    <head>
        <title></title>
        <script src="js/lib/jquery/jquery-1.8.1.min.js"></script>
        <script src="js/lib/kendoui/kendo.web.min.js"></script>
        <link href="css/KendoUI/kendo.common.css" rel="stylesheet" />
        <link href="css/KendoUI/kendo.blueopal.css" rel="stylesheet" />
    </head>
    <body>
        <div id="example" class="k-content">
            <div id="grid"></div>
 
            <script>
                $(document).ready(function() {
                    var crudServiceBaseUrl = "http://127.0.0.1:8081/cors", dataSource = new kendo.data.DataSource({
                        transport : {
                            read : {
                                url : crudServiceBaseUrl + "/People",
                                dataType : "json"
                            },
                            update : {
                                contentType: "multipart/form-data",
                                type: "POST",
                                url : crudServiceBaseUrl + "/People/?$method=update",
                                dataType : "json",
                                 data: {
                                        __KEY: 26,
                                        __STAMP: 23,
                                        ID: 26,
                                        firstName: "fgsdf44",
                                        lastName: "dsdfgdfg"
                                        }
                            },
                            destroy : {
                                url : crudServiceBaseUrl + "/People(28)/?$method=delete",
                                dataType : "json"
                            },
                            create : {
                                url : crudServiceBaseUrl + "/People/Create",
                                dataType : "json"
                            },
                            parameterMap : function(options, operation) {
                                if (operation !== "read" && options.models) {
                                    return {
                                        models : kendo.stringify(options.models)
                                    };
                                }
                            }
                        },
                        schema : {
                            data : "__ENTITIES",
                            model : {
                                id : "ID",
                                fields : {
                                    __KEY : {
                                        editable : false,
                                        nullable : true
                                    },
                                    __STAMP : {
                                        editable : false,
                                        nullable : true
                                    },
                                    ID : {
                                        editable : false,
                                        nullable : true
                                    },
                                    firstName : {
                                        validation : {
                                            required : true
                                        }
                                    },
                                    lastName : {
                                        validation : {
                                            required : true
                                        }
                                    }
                                }
                            }
                        }
                    });
 
                    $("#grid").kendoGrid({
                        dataSource : dataSource,
                        pageable : true,
                        height : 400,
                        toolbar : ["create"],
                        columns : ["__KEY", "__STAMP", "ID", "firstName", "lastName", {
                            command : ["edit", "destroy"],
                            title : " ",
                            width : "210px"
                        }],
                        editable : "inline"
                    });
                });
            </script>
        </div>
 
    </body>
</html>

No answers yet. Maybe you can help?

Tags
Data Source
Asked by
Daniel
Top achievements
Rank 2
Share this question
or