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

How can I get transport type in dataSource.error method?

1 Answer 269 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shiji
Top achievements
Rank 1
Shiji asked on 28 Jan 2013, 10:45 AM
I'm using the kendoGrid, but I don't know the type of transport which is raising the error. Can I get it in any way?
Here is the sample code:
dataSource = {
transport: {
                    read: "http://www.mysite.com/get",
                    update: {
                          url: "http://www.mysite.com/update",
                          data: {}
                    },
                    destroy: {
                          url: "http://www.mysite.com/delete",
                          data: {}
                    },
                    create: {
                          url: "http://www.mysite.com/create",
                          data: {}
                    }
                },
                error: function (e) {
                      //todo: How can I get which type of request is making? get, update, destroy, or create? Different error types have different error message.
                }
};

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 30 Jan 2013, 09:28 AM
Hello Shiji,

The error event parameter does not contain information about the transport type. I suggest you to hook up to the complete event of the transport requests:
update: {
      url: "http://www.mysite.com/update",
      data: {},
      complete: function(e) { console.log("update failed"); }
},
destroy: {
      url: "http://www.mysite.com/delete",
      data: {},
      complete: function(e) { console.log("destroy failed"); }
},
create: {
      url: "http://www.mysite.com/create",
      data: {},
      complete: function(e) { console.log("create failed"); }
}

Please note that the complete fires after error event.
I hope this will help.

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