This is a migrated thread and some comments may be shown as answers.

datasource.sync(), server error, leave edit mode, lose dirty indicator

2 Answers 264 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elko
Top achievements
Rank 1
Elko asked on 18 Apr 2013, 08:24 AM
Hi to all,
we are facing a behaviour from grid/datasource, which looks as a serious 'bug' to our customers.

The scenario is as following :

1) The grid is set up for 'Inline' editing.
2) The user changes to 'Edit' mode, changes some values.
3) Press 'Update' button
4) an error occurs in server side processing , the error handler displays a message.
->
5) now the grid row leaves the edit mode, removes dirty indicators and (!!) displays the new values changed from user.

This is very confusing for the user because he has no clue of the current data state.

Is there an approach or sample how to reset the grid row to 'Edit Mode' and indicate the current state of the grid/row.

Thanks
Thomas


2 Answers, 1 is accepted

Sort by
0
Elko
Top achievements
Rank 1
answered on 18 Apr 2013, 08:27 AM
.....
0
Accepted
Elko
Top achievements
Rank 1
answered on 19 Apr 2013, 08:23 AM
Hello,

we solved it with info from the following

http://www.kendoui.com/forums/mvc/grid/handling-errors-on-insert-pop-up-edit-form.aspx

<script type="text/javascript">
    function error_handler(e) {    
        if (e.errors) {
            var message = "Errors - TM :\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function() {
                        message += this + "\n";
                    });
                }
            });        
            alert(message);


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


        }
    }
</script>

Thomas
Tags
Grid
Asked by
Elko
Top achievements
Rank 1
Answers by
Elko
Top achievements
Rank 1
Share this question
or