jquery - Kendo Grid Ajax Error Handling - Getting Grid Element ID -


i'm working on common method handle ajax errors kendo grids in app. part of js function, i'm displaying error , cancelling changes grid. there's got better way id grid i'm doing below - feels hack me (even though work in tests). have better way handle this?

// common kendo grid ajax error handler function kendogridajaxerrorhandler(result) {     var msg = result.xhr.status + ' ' + result.xhr.statustext + '\n' + result.xhr.responsetext;     alert(msg);     var id = result.sender.options.table[0].parentnode.parentnode.id;     $('#' + id).data('kendogrid').cancelchanges(); }; 

the error event exposed datasource , not grid. result cannot grid within error handler. if possible can try distinguishing grid based on data source option e.g. read url:

function kendogridajaxerrorhandler(result) {     var datasource = this;     var read = datasource.options.transport.read.url;     if (readurl == "/customers/read") {        // customers grid     } else {        // other grid     } } 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -