Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a reference to Kendo Grid from inside the error handler

There already are questions how to get custom error handling, with answers, but all those answers use 'external' reference/selector to the grid to make it work, for example:

function onError(e) {
    if (e.errors) {
        var message = "Error:\n";  

        var grid = $('#gridID').data('kendoGrid'); // <<- here
    (...)
}

Is it possible to get the reference to the grid from inside the error handling function without providing the selector by hand or 'externally' (because global variables are meh)? That way the error handling script could be totally self-contained.

like image 942
Patryk Ćwiek Avatar asked Jan 02 '14 15:01

Patryk Ćwiek


1 Answers

I would suggest passing the target grid id as an argument to your function. Example: .Events(events => events.Error("function(args){telerikGridAraxErrorhandler(args,'myGridId');}"))

I think it will result in less support in case they change anything in future versions of Telerik Grid

like image 122
Sergey T Avatar answered Oct 24 '22 04:10

Sergey T