Hi there,
I am struggling with datasource create transport. While normally the correct parameter to a rails server for creating a new item is as follow:
Started POST "/shoes" for 127.0.0.1 at 2012-03-10 18:10:32 +0700
Processing by ShoesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"QrQCjdrZTYpNCbCDeh8iCxSbUdFo7aTHg+GeGKTpNuA=", "shoe"=>{"name"=>"the correct format", "price"=>"", "url"=>"", "replacement_mileage"=>""}, "commit"=>"Create Shoe"}
But kendoui's data source create transport sends the following format:
Started POST "/shoes.json" for 127.0.0.1 at 2012-03-10 18:10:35 +0700
Processing by ShoesController#create as JSON
Parameters: {"name"=>"shoename"}
Thank you in advance.
My script is as follow:
I am struggling with datasource create transport. While normally the correct parameter to a rails server for creating a new item is as follow:
Started POST "/shoes" for 127.0.0.1 at 2012-03-10 18:10:32 +0700
Processing by ShoesController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"QrQCjdrZTYpNCbCDeh8iCxSbUdFo7aTHg+GeGKTpNuA=", "shoe"=>{"name"=>"the correct format", "price"=>"", "url"=>"", "replacement_mileage"=>""}, "commit"=>"Create Shoe"}
Started POST "/shoes.json" for 127.0.0.1 at 2012-03-10 18:10:35 +0700
Processing by ShoesController#create as JSON
Parameters: {"name"=>"shoename"}
Thank you in advance.
Item = kendo.data.Model.define({id:
"id"
});
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url: (
"shoes.json"
)
},
create: {
url:
"shoes.json"
,
type:
"POST"
}
},
schema: {
model: Item
},
});
dataSource.read();
$(
"#items"
).html(kendo.render(template, dataSource.view()));
dataSource.add({
"name"
:
"shoename"
});
dataSource.sync();