Update child without validation errors

2 posts, 0 answers
  1. Aldo
    Aldo avatar
    5 posts
    Member since:
    Nov 2014

    Posted 09 Dec 2014 Link to this post

    Hi there,
    I've a Scheduler and a Grid, i want to update the schedule when someone create or update the items in the grid.

    I've subscribed the sync event with: .Events(events => events.Sync("sync"))

    then I update the scheduler:

     function sync(args) {

    it works, but if there is a server validation error the editor popup quits and the user can't see the validation error.
    How can I detect a successfully update?

    Server validation is implemented as in the example provided:

    <script type="text/kendo-template" id="message">
        <div class="k-widget k-tooltip k-tooltip-validation k-invalid-msg field-validation-error"
             style="margin: 0.5em; display: block; " data-for="#=field#" data-valmsg-for="#=field#" id="#=field#_validationMessage">
            <span class="k-icon k-warning"> </span>#=message#<div class="k-callout k-callout-n"></div>

    <script type="text/javascript">
        var validationMessageTmpl = kendo.template($("#message").html());

        function error(args) {
            if (args.errors) {
                var grid = $("#grid").data("kendoGrid");
                grid.one("dataBinding", function (e) {
                    e.preventDefault();   // cancel grid rebind if error occurs

                    for (var error in args.errors) {
                        showMessage(grid.editable.element, error, args.errors[error].errors);

        function showMessage(container, name, errors) {
            //add the validation message to the form
            container.find("[data-valmsg-for=" + name + "],[data-val-msg-for=" + name + "]")
                     .replaceWith(validationMessageTmpl({ field: name, message: errors[0] }))


  2. Daniel
    Daniel avatar
    2231 posts

    Posted 11 Dec 2014 Link to this post


    In the sync event handler I can suggest to check if there are any pending changes in the dataSource e.g.
    function sync(args) {
        if (!this.hasChanges()) {
    If changes were correctly synchronized with the server then there should be any pending changes in the dataSource. An alternative would be to use the requestEnd event instead and check if there are any errors in the response.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top