stay edit mode on server side validation fails

4 posts, 0 answers
  1. Soori
    Soori avatar
    7 posts
    Member since:
    Jun 2013

    Posted 05 Jun 2014 Link to this post

    Hi,
    I am sending an ajax request inside datasource update method. How can stay in edit mode if this request fails ?

    Following is a sample code snippet of mine .

     this._datasource = new kendo.data.DataSource({
                  transport: {
                    create: create,
                    read: read,
                    update: update,
                    destroy: destroy
                }
    })

      function update(options) {
                    that._api.put(resource, inputData)
                        .done(function (data) {
                      
                        })
                        .fail(function (error) {
                                 that._datasource.cancelChanges();
                        });       
            }
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 09 Jun 2014 Link to this post

    Hello Charith,

    The Grid should not close until the success function of the arguments object is not invoked. Here is a small demo:

    http://trykendoui.telerik.com/@pesho/ehAb

    Feel free to modify the example and share if you have different setup. Let me know if I missed something

    Kind Regards,
    Petur Subev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Soori
    Soori avatar
    7 posts
    Member since:
    Jun 2013

    Posted 09 Jun 2014 in reply to Petur Subev Link to this post

    Thanks Petur . But the problem is with ListView . Save event fires before update process finishes . 
  5. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 09 Jun 2014 Link to this post

    Hello Chartih,

    My apologies I forgot that detail. Indeed when using the ListView it will close the edit mode immediately after starting the request (so the edit mode will be closed before the response is sent to the client). So you can prevent the save event of the ListView. The same question is discussed here:

    http://www.telerik.com/forums/keep-listview-in-edit-mode-after-server-side-error

    The DataSource will anyway trigger a change event and the ListView will successfully close edit mode if the response will "successful save".

    I hope this helps.

    Kind Regards,
    Petur Subev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready