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

Grid Datasource create on REST end point

1 Answer 50 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
andrew
Top achievements
Rank 1
andrew asked on 15 Apr 2013, 07:15 AM
I have
kendoGrid({
        dataSource : {
            transport : {
                read : "http://testsite/rest/receipts/_list_last/10.xml",
                create : {
                    url : "http://testsite/rest/receipts.xml",
                    dataType : "xml",
                    type : "POST",
                    contentType : "text/xml",
                    processData : false,
                    batch : false
                },
                parameterMap : function(data, type) {
                    if (type === "create") {
                        var postxml = '<reciept><id></id><tenant>';
                        postxml += data.tenant;
                        postxml += '</tenant>';
                        return postxml;
                    }
                }
            }

When I hit "add new record", every record in the grid including the new one is sent to the server.
Is there a way to prevent this and only allow the newly added record to get POST'ed to the server?
Kind Regards
Andrew

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 17 Apr 2013, 05:57 AM
Hi,

This behavior will occur if the items' ID is not defined or if it is equal to the default value. Please verify that the ID is properly defined in the schema model and that it is parsed when reading the data.

Kind regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
andrew
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or