e.preventDefault() prevents the kendo 'read' event but does not work for 'create' on update keypress in kendo popup editor -


 transport: {             parametermap: function (data, operation) {                 if (operation !== "read") {                     return json.stringify(data);                 } else {                     return (data);                 }             },             read: {                 url: function () {                     return moduleserviceroot;                 },                 type: "get",                 datatype: "json",                 async: true             },             create: {                 url: function (rec) {                     return moduleserviceroot;                  },                 type: "post",                 contenttype: 'application/json; charset=utf-8',                 datatype: "json",                 async: true             },             complete: function (e) {                 $("#grid").data("kendogrid").datasource.read();                 async: true             },         },         requeststart: function (e) {             console.log('request started');             if (e.type == 'create' & validinput == false) {                 console.log('request started');                 e.preventdefault();             }         } 

in above code validinput false. if comment out if statement kendo grid read operation prevented (grid not show data) if uncomment it, won't work kendo create, when hit update in kendo popup editor.

create: function (options) {                 if (validinput) {                     $.ajax({                         url: moduleserviceroot,                         datatype: "json",                         type: "post",                         contenttype: 'application/json; charset=utf-8',                         async: true,                         data: json.stringify(options.data),                         success: function (result) {            // notify data source request succeeded,                             options.success(result);                         },                         error: function (result) {              // notify data source request failed                             options.error(result);                         }                     });                 }             } 

and works fine


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -