а

Mark timespan deleting by days


#1

Hi,

I am having problems in deleting mark timings by days…

 scheduler.deleteMarkedTimespan({
   days: new Date(datee),
   sections: {
    single_unit: id,
   week_unit: id
  }

});

If i go with DATE in deleting this… It works fine.
But if i go with day or days… even with fullday done selection… doesn’t work
like below

scheduler.deleteMarkedTimespan({
days: [0,1,2,3,4,5,6]
sections: {
single_unit: id,
week_unit: id
}
}

Can anyone tell me what is wrong with this. ?

Regards


#2

Please, pay attention to the fact that the “addMarkedSpan” and “deleteMarkedSpan” methods work correctly only when the “days” property matches.

It means that when you use new Date (date) or an array with weekdays in the “days” property in the “addMarkedSpan”, you should use the same in the “deleteMarkedSpan” method.

Here is the snippet where you can see how it should be:

http://snippet.dhtmlx.com/ef4ffbb3e


#3

Hi @ElenaD thanks for the reply…

So you mean there is no way if i have marked some dates by using new Date() method to some days
i.e ( 2019-01-01 Monday — 2019-01-03 Wednesday — 2019-01-05 Friday )

And later on i just want to clear all marktimespans day wise… i.e [0,1,2,3,4,5,6] = all days…
Shouldn’t this work ?

Just like in this
http://snippet.dhtmlx.com/093cf790f

If this isn’t possible how can i just clear all markings no matter with which method they were marked i.e … by day or new Date()… ?.. :neutral_face:
I’m waiting


#4

And if you could help me there as well…

Thanks Regards


#5

Hi,

Yes, if you set date new Date(2019,7,2) to the “days” property of addMarkedTimespan, and then specify integer numbers days: [1,5], corresponding to the days of the week in the “days” property of deleteMarkedTimespan - it will not work: http://snippet.dhtmlx.com/d8ec85bb3
You must use one of these ways for both methods.

If this isn’t possible how can i just clear all markings no matter with which method they were marked i.e … by day or new Date()… ?.. :neutral_face:

To clear all marked timespans please use deleteMarkedTimespan without parameters.
scheduler.deleteMarkedTimespan()
https://docs.dhtmlx.com/scheduler/api__scheduler_deletemarkedtimespan.html

Also you can add and remove marked timespans dynamically.
You need to delete all timespans each time when you change the displayed range by prev/next buttons in the onBeforeViewChange handler.
Then check dates in the active view, put required of them to the array and set this array contains dates that you want to mark to the ‘days’ in addMarkedTimespan method when onViewChange handler fires.

Please check the demo that demonstrates how it works:
http://snippet.dhtmlx.com/9c61b2f26