Pergunta

I'm using kendo scheduler and I want to use server validation. When server returns validation error (via ModelState - ToDataSourceResult extension) then I want to show them in popup. Now I have problem how to prevent editor window to be closed?

I have following code (it works for grid popup editor and server validation errors):

onError: function (args) {
    if (args.errors) {
        var scheduler = $("#scheduler").data("kendoScheduler");

        scheduler.one("dataBinding", function (e) {
            e.preventDefault(); // cancel grid rebind if error occurs - this prevents window to closing  

            /* some error handling */
        });
    } else {
        alertify.error("Unknown error occurred");
    }
}

I found following code which looks like a bug. This is "refresh" method od scheduler. I think that it should check result of trigger("dataBinding") and call _destroyEditable when event wasn't prevented:

this.trigger("dataBinding");

if (!(e && e.action === "resize" && this.editable)) {
    this._destroyEditable();
}

EDIT:

Here's code from grid:

 if (that.trigger("dataBinding", { action: e.action || "rebind", index: e.index, items: e.items })) {
    return;
}
Foi útil?

Solução 2

I post the same question on telerik forum and fix will be added to next internal build.

http://www.kendoui.com/forums/kendo-ui-complete-for-asp-net-mvc/scheduler/how-to-prevent-editor-from-closing-.aspx

Outras dicas

Currently the Kendo UI Scheduler doesn't support prevention of the dataBinding event. You can try modifying the actual source code like this:

if (this.trigger("dataBinding")) {
   return;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top