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

Global error handler for numerous grids

2 Answers 365 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 19 Mar 2013, 12:22 PM
I've currently inherited an application which has numerous Kendo grids (and other controls) throughout, and I'm trying to fix an error which keeps cropping up now and again - specifically when the user is no longer authenticated.

I know what the solution is for a single instance of the control - return a flag to indicate authentication failed, and then detect this in the error handler and perform the authentication.

The problem is am I really going to have to handle this for every instance of a Kendo control I have? Is there not a global error handler I can hook into for the DataSource? Or the grid or all Kendo controls?

This would be a more straighforward short term solution than refactoring everything to specific error handlers, etc.

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Mar 2013, 11:42 AM
Hello,

You could specify a default error handler for the dataSource e.g.

kendo.data.DataSource.prototype.options.error = function (e) {
   //your logic
};
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!
0
Steve
Top achievements
Rank 1
answered on 21 Mar 2013, 11:55 AM
Thanks Daniel. Looks like an interesting solution. I actually received a response on StackOverflow which I've just implemented and which works well. It has the added bonus of hooking into all Ajax on the site - not just the Kendo controls.

But your solution would come in handy just for handling Kendo DataSource errors.
Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Steve
Top achievements
Rank 1
Share this question
or