Browse Source

Fixed bug with cancelling editing events

Kenric Nugteren 9 months ago
parent
commit
7df8084902
2 changed files with 9 additions and 0 deletions
  1. 1 0
      prs.classes/Entities/Events/EventSubscriber.cs
  2. 8 0
      prs.shared/Grids/EventGrid.cs

+ 1 - 0
prs.classes/Entities/Events/EventSubscriber.cs

@@ -9,6 +9,7 @@ namespace Comal.Classes
     {
         public EventLink Event { get; set; }
 
+        [EditorSequence(1)]
         public EmployeeLink Employee { get; set; }
 
         static EventSubscriber()

+ 8 - 0
prs.shared/Grids/EventGrid.cs

@@ -263,6 +263,14 @@ public class EventGrid : DynamicDataGrid<Event>
                 ev.Data = "";
             }
         }
+        else
+        {
+            // We have to 'cancel' by just re-deserialising.
+            if(ev.Data is not null && ev.Data.Length != 0)
+            {
+                EventData = EventUtils.Deserialize(ev.Data);
+            }
+        }
     }
 
     protected override void Reload(Filters<Event> criteria, Columns<Event> columns, ref SortOrder<Event>? sort, CancellationToken token, Action<CoreTable?, Exception?> action)