Global error handler for numerous grids

3 posts, 0 answers
  1. Steve
    Steve avatar
    2 posts
    Member since:
    Mar 2013

    Posted 19 Mar 2013 Link to this post

    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. Daniel
    Admin
    Daniel avatar
    2225 posts

    Posted 21 Mar 2013 Link to this post

    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!
  3. Steve
    Steve avatar
    2 posts
    Member since:
    Mar 2013

    Posted 21 Mar 2013 Link to this post

    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.
Back to Top