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

Events for After Update / After Destroy / After Create...

2 Answers 2396 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robin
Top achievements
Rank 1
Robin asked on 18 Jul 2012, 08:22 PM
Is there a way to have a function called after the Grid (or DataSource for that matter) performs an Update,Destroy, Create ?
I see where there are functions for before the CRUD operation is called, but not for after.  Something like UpdateSuccess or some such.
I need to perform some other functions, but if I do it, the object still exists on the database so any new requests for data will include the object being updated/deleted etc.

2 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 23 Jul 2012, 01:21 PM
Hello Robin,

Currently the dataSource does not have a success event for specific CRUD operation. The change event is wired to the $.ajax() success event and will trigger after a data operation is completed, however please have in mind that this event fires every time when the data is changed.

Upon update, the DataSource expects the result (optionally) to contain data with the same structure as the read request one. If such data is present, the dataSource models will be updated with the new ones received from the server. You may use this functionality to perform the additional changes on the server and return the updated record.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
1
Ralph Wally
Top achievements
Rank 1
answered on 02 Apr 2013, 09:44 AM
Hello Robin,

You can use the datasource's event which is the requestEnd. This event has the event argument response and type. The type value can be create update read or destroy, with that you can identify what event happened, so the only thing that you need to do now is just return a value from your server whether the transaction is a success or failure if it is a failure you can also add some additional info if you want to.
Tags
Grid
Asked by
Robin
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Ralph Wally
Top achievements
Rank 1
Share this question
or