I’ve been trying to register a global ajax error handler for my site but I think there is an issue in the jquery.yiigridview.js that is preventing me from getting it working robustly. And possibly other widget javascript implementations as well.
I can regeister a global or default error handler with either
$(document).ajaxError(function (event, xhr, ajaxOptions, thrownError) { /* some code */ });
or
$.ajaxSetup({
error: function (event, xhr, ajaxOptions, thrownError) { /* some code */ }
});
And this works fine except with a CGridView widget. When an error occurs it uses its own error handler. Which either gets called before the global error handler (first example) or over writes the error handler (second example)
What I think should happen is the update ajax request in jquery.yiigridview.js (Line 263) should not define a error function if a default one has been setup.
Also the line 265
$grid.removeClass(settings.loadingClass);
should be moved into the complete function of the ajax call.