deleteMarkedTimespan : doc to update (or maybe a solution ?)

Hi,

1/ deleteMarkedTimespan

About the documentation : docs.dhtmlx.com/scheduler/api__s … espan.html

After a lot of tests, I (think to) have finally understood that it was not possible to use deleteMarkedTimespan() by passing neither “days: new Date()” or “<start|end>_date: new Date()” if the timespan was created by passing days: [X,Y,Z].

If it is really the case that could be notice in documentation, as it is done for days/zones vs start/end on addMarkedTimespan(), with in plus the fact that “days: []” creation does not allow a “days: new Date()” deletion.

By the way, if it possible it would be great. For the moment I think about using a onBeforeViewChange() event (or another) to add markedTimespan “on real time” instead at startup.
What I want to do : be able to add markedTimespans on all days (0 to 6) with zones, but delete them for precise dates (I would add specific new markedTimespans fot theses precise dates).

2/ I think about something I see recently (without finding a solution, I will se later maybe) : when using markTimespan() on a day, the timespan cover the events if the timespan is added after the events were loaded (eg: markTimespan + scheduler.updateView();)

Thanks

Hello,

Today I have the time to add some code to explicit the request.

After initialization of the schedule, this part of code adds dynamically and correctly marked timespans on every Tuesday, Wednesday and Thursday :

var onetry = scheduler.addMarkedTimespan({
    days: [2,3,4], // eg. Tue 2013-12-17, Wed 2013-12-18 and Thu 2013-12-19
    zones: "fullday",
    css: "onecssclass"
});
scheduler.updateView();

This part of code could remove the marked timespan on one Wednesday (the 2013-12-18) (the fullday), but it does not (nothing happens):

scheduler.deleteMarkedTimespan({
    days: new Date(2013, 11, 18), // in this case : Wed 2013-12-18
    zones: 'fullday',
});
scheduler.updateView();

I have already tried the code above but it does not works :

scheduler.deleteMarkedTimespan({
    start_date: new Date(2013, 11, 18), // in this case : Wed 2013-12-18
    end_date: new Date(2013, 11, 18)
    // or event with start_date / end_date with hours in Date() to try and delete  "zones" like that :
    // start_date: new Date(2013, 11, 18, 6) // from Wed 2013-12-18 6:00
    // end_date: new Date(2013, 11, 19, 12) // to Wed 2013-12-18 12:00
});
scheduler.updateView();

If someone has some idea, they’re welcome :slight_smile:
Thanks.

As far as I can see, in the existing version you can’t add exceptions to recurring timespans. So if you have some marked area for every Tuesday, you can’t remove that marker from some specific Tuesday. It is all or none situation.

We have some ideas how it can be improved in the next versions, but for now it may be better to avoid “days” and define timespans for exact dates, where they are necessary.

Hi Stanislav,

Thanks for the reply. I will follow this potential future implementation with interest.

Currently, adding recurring markedTimespans day by day can be a serious/long JS process if this is done “in one shot” and the range of dates to mark is (very) large.

For those who read this topic, the solution I chose was to dynamically add markedTimespans day by day according to the current mode (view) and the current view range date (min/max) by caching added markedTimespans dates to avoid to launch again the process when coming back on a view already parsed (and marked).
I do not know if this explication is comprehensible, I hope. To resume : an oriented lazy loading process.

I have although used the “day/zones” implementation but with Date object in days keys, which was more relevant for me (the Date allows to target precise dates as you said and zones allows the use of an array with multiple timespans for one day.

Thanks again, that’s OK for me !