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

Refresh Row Before Edit

3 Answers 221 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott Rakestraw
Top achievements
Rank 1
Scott Rakestraw asked on 12 Apr 2013, 03:33 PM
I have two requirements
  1. Before editing a record make sure no one else is editing it
  2. Refresh the data for that record before editing
I have added a custom button instead of the standard edit that will check if anyone else is editing it and pull the new data.  I go and update all the columns with the new values but my problem is if the user clicks cancel it reverts back to the old values.  I have tried setting the dirty flag to false but that does not seem to have any affect.

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 16 Apr 2013, 07:52 AM
Hi Scott,

 
Basically such scenario is not supported out-of-the-box and you should implement it using custom code depending entirely on you and the current setup that you have. For example if you are using ASP.NET MVC as a server technology it's possible to achieve the desired behavior using SignalR. In this case you have to listen for the edit and save events of the grid. When the grid enters in edit mode, we get the row, that is currently being edited and send a signal to the server to lock this record in all other instances of the grid. On saving we send the opposite signal to the server, informing him, that the editing is done and the record is ready to be unlocked again. For your convenience I am attaching a sample project, which demonstrates the described approach.


Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Scott Rakestraw
Top achievements
Rank 1
answered on 16 Apr 2013, 12:36 PM
I am not having any problem locking the record or refreshing the data.  The only problem I am having is that after I pull the new data if the user then clicks cancel it shows the old data.  I need to have some way to tell the datasource that the data it has is the current data without needing to resync.  I pull back a new version of the record that is about to be edited, loop through all the properties and update the original record.  Now I need the datasource to recognize that it is in sync.
0
Vladimir Iliev
Telerik team
answered on 18 Apr 2013, 11:31 AM
Hi Scott,

 
As I mention in my previous reply current scenario requires custom solution which is out of scope of our support service. The update that you mention is possible however you should implement it using custom code (there is "pristine" collection in the dataSource which should be updated to prevent losing the last changes on "cancelChanges").

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Scott Rakestraw
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Scott Rakestraw
Top achievements
Rank 1
Share this question
or