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

stay edit mode on server side validation fails

3 Answers 111 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Soori
Top achievements
Rank 1
Soori asked on 05 Jun 2014, 11:03 AM
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();
                    });       
        }

3 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 09 Jun 2014, 10:53 AM
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!
 
0
Soori
Top achievements
Rank 1
answered on 09 Jun 2014, 10:58 AM
Thanks Petur . But the problem is with ListView . Save event fires before update process finishes . 
0
Petur Subev
Telerik team
answered on 09 Jun 2014, 01:16 PM
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!
 
Tags
ListView
Asked by
Soori
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Soori
Top achievements
Rank 1
Share this question
or