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

Datasource remove, unexpected behaviour

1 Answer 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 09 Jun 2014, 11:40 AM
Hi,
The following is my (coffee) datasource code excerpt:

schema:
  model:
    id: 'id'
transport:
  destroy:
    url: (model) -> ApiUrl "transmittals/transmittal/#{model.id}"
    type: 'DELETE'
    data: {}

A few things:
.I'd expected the destroy to use type = delete by default, no?
.I'd expected it to add the id to the url itself - do i have to inject it myself (like above)?
.Currently kendo is sending my entire model along with the request, ho can i prevent that?

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 11 Jun 2014, 11:47 AM
Hello Tom,

Let me get straight to the answers:
  • The Destory request's default type is GET as mentioned in the documentation
  • The ID is not automatically added, so manually inserting it is the way to go if the back-end service expects it to be in the URL
  • This could be achieved in couple of ways:
    • Return an empty object in the the parameterMap function of the operation is Destroy
    • Specify the CRUD operations as functions and manually make the Ajax requests. For example: 
      transport: {
        read: function(options) {
          $.ajax({
            dataType: "jsonp",
            success: function(result) {
              options.success(result);
            }
          });
        },


Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Tom
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or