I am trying to figure away of refreshing some ‘hidden’ event data after an update. I am using the .NET connector as well.
I am implementing concurrency in my EVENTS table with a field called modified. Everytime the event is updated the modified field is timestamped in the database update procedure. On an event update the modified value is passed and if it matches the current value in the database it allows the update.
On the first load of the calender the event has the correct modified value, after an edit and save the event no longer has the correct modified value as it is the old value and not the new one that was timestamped after the update/save.
Is there a way that I can set event date manualy (or pass a change back from the connector) in this case the modifed field.
I tried using the AfterUpdate event on the connector to set the modified value. It sets the value, but the Event in the schedular does not pick up the changed information. See below.
Public Sub connector_AfterUpdate(ByVal sender As Object, ByVal args As dhtmlxConnectors.DataActionProcessingEventArgs)
args.DataAction.Data(CType("MODIFIED", dhtmlxConnectors.TableField)) = "xxxxxxxxxxxx"
End Sub
I have added a new eventhandler that will return only one item based on the Id of waht was updated. I placed the load call in the onEventChanged. The issue is that the DB update occurs after this event is fired…so the load grabs the data before the change.
In what event should i make the load call to ensure the DB update has completed. Note im using the .NET connector.
Ok so I figured it should be placed in the dataProcessor onAfterUpdateEvent.
Now the issue Im having now is after the first update it gets the new data, but on the second update it gets the first updates date. I assume its caching the link response so I put a random in the URL but still doing the same thing.
If anyone is interested in my final solution here it is.
I set the args.DataAction.Details in the connector_AfterUpdate Event. This then becomes available in the dataProcessor updated event.
Public Sub connector_AfterUpdate(ByVal sender As Object, ByVal args As dhtmlxConnectors.DataActionProcessingEventArgs)
Dim i As Integer = 1
Dim EventsBO As New COEventsBO.EVENTS
args.DataAction.Details = EventsBO.GetModifiedTimeStampStringById(args.DataAction.PrimaryKeyValue, New Guid())
args.DataAction.SetCompleted()
End Sub
Value set in step 1 is now avialble in the response parameter. This can then be used to update the event direct.
dp.defineAction("updated", function (response) {
var sid = response.getAttribute("sid");
var ev = scheduler.getEvent(sid);
ev["MODIFIED"] = response.text;
ev._changed = true;
scheduler.event_updated(ev, true);
return true;
})
I would be interested in hearing if there is a better way.
Cheers…
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan