Reputation: 59
I have successfully used the DHTMLX Scheduler to CRUD event records too and from my database. My requirement is on recurring events.
At the moment if I create a recurring event, a single record is created on the database with the recurring details added.
What I would like to do is save the individual recurring events to the database instead of the single "master" event.
I know that DHTMLX scheduler does not allow this normally, so I will have to write some code using the API, but I cannot find a way to pull out the individual events from the master before its written to the database.
Any help will be appreciated.
Upvotes: 1
Views: 737
Reputation: 968
There is no simple way to do what you need (at least I'm not aware of such way). You can try a couple of things.
Firstly, you can try implementing all the logic on the client. Although scheduler does not provide a public method for parsing recurring event into single entries, there is a private method you could use
So you can detect when the event is added into the scheduler, split it into separate records and send then to your handler that will do database insert. Here is small demo http://docs.dhtmlx.com/scheduler/snippet/451753cb
Alternatively, you could try parsing recuring event on server, right before inserting.
The implementation will depend on the server side you use.
If it's PHP, there is a helper for recurring events https://github.com/DHTMLX/scheduler-helper-php However, it can only read events from the database, there is no method to parse a single event you provide, so it will take some coding to make it work.
If you use .NET, the helper library provides needed method so you could process recurring event and insert it into db without big issues http://scheduler-net.com/docs/recurring-events.html#getting_instances_of_recurring_events
If you use a different platform - I'm afraid you'll have to write your own parser of recurring events, in order to process them on the server side.
And after event is saved that way, scheduler will no longer recognize it as recurring series, so there won't be built-in controls for deleting or modifying all occurrences at once.
As you probably can see by now, while there are a couple of possible ways to implement what you need, there is also a number of issues which could bring a lot of pain.
Maybe you could clarify why do you need such logic. Possibly the original issue could be addressed in easier way.
Upvotes: 2