different addMarkedTimespan on different views

Hi there -
I’ve setup a unit page and am using addMarkedTimespan to highlight background ranges. I’d like to have a different set of ranges highlighting the background in the week view. In the case of my unit view, I do something like -
scheduler.addMarkedTimespan({
start_date: d1,
end_date: d2,
css: “green_section”,
sections: {
unit: 2
}
});

What do I use as the item (equivalent of “unit”) in the sections: part in order to target the “week” view?

Thanks in advance,
Irv

Note that I’ve tried a different approach where I do the addMarkedTimespan globally and then do a deleteMarkedTimespan with the section: unit set using the same data time ranges (assuming that will only get rid of what’s on the unit view page). Then I do the addMarkedTimespan with the section: unit set using a different set of data.
However, for some reason, the deleteMarkedTimespan doesn’t work when I include the specific configuration properties (note that deleteMarkedTimespan() works when I use it without config properties). Is there an issue with deleteMarkedTimespan when using configuration properties?

Anyway, all that to say that if there is a way that I can apply addMarkedTimespan to the non unit views (day, month, year - as I asked about in the original start of this thread) and then do the addMarkedTimespan applied to the unit view, that would be great.

Thanks,
Irv

Hello,

Please check out documentation: docs.dhtmlx.com/doku.php?id=dhtm … edtimespan
If you call addMarkedTimespan without specifying sections list then it will be applied to default views: day, week, month (though hidden).
It won’t work for year view.

And if you specify sections then it will be applied only for those views (and have priority over default-global marked timespans).

Please provide your corresponding addMarkedTimespan command and then how you have tried to delete it.

Kind regards,
Ilya

Hi Ilya -
Thanks for getting back to me.
So just to be clear - I was originally asking if there was a way to call addMarkedTimespan on just the default views (day, week) and not the unit view by doing something like -

scheduler.addMarkedTimespan({
start_date: new Date(“2012,11,21 9:30”),
end_date: new Date(“2012,11,21 10:30”),
css: “green_section”,
sections: {
week: whatever // ** some way of specifying only the default week/day and not unit
}
});

I assume from your reply that the answer is no.
Basically, I’d like to highlight a set of ranges in my unit view that are not the same as the ones in the default (week,day) view. So either I can draw the default only and then do the unit view (but without a specific week/day item for the section, this results in the unit view being drawn as well). Or alternately draw the default view (which will draw the unit view as well), then erase the unit view with deleteMarkTimspan and then use addMarkedTimespan for the unit view only.

An example of the latter would be as follows -

scheduler.addMarkedTimespan({
start_date: d1,
end_date: d2,
css: “green_section”,
});

scheduler.deleteMarkedTimespan({
days: [0,1,2,3,4,5,6],
zones: “fullday”,
sections:{ unit: [1,2,3] }
});

scheduler.addMarkedTimespan({
start_date: d3, // different from above addMarkedTimespan
end_date: d4,
css: “green_section”,
sections:{ unit: [1,2,3] }
});

scheduler.updateView();

Both addMarkedTimespans get drawn, but the deleteMarkedTimespan doesn’t. I’ve tried a lot of different variations without any luck.

Irv

Was hoping for some sort of solution for this.
So far, my understanding is that if you do an addMarkedTimespan without specifying the unit view, then the whole calendar, including the unit view will be marked, and … after that, applying deleteMarkedTimespan to only the unit view will not clear what has been marked by that original global addMarkedTimespan.
Correct? Or is there a way to do this?
Thanks,
Irv

Hello,

Calling addMarkedTimespan without sections means you are setting up global/default timespans. They will be applied to all views.

If you specify sections - it sets up specific timespans. They override default ones.

You can delete only something you’ve set up beforehand. So if you have global marked timespan - you an delete it (or part of it). Calling delete on sections timespan without first specifying it will do nothing.

Kind regards,
Ilya

So is there anyway to exclude a specific unit section from a global addMarkedTimespan?
Or alternately, do you have a suggestion on how to do what I’m trying to do?
Thanks,
Irv

I guess I’ll just check for what view/mode I’m in and then high-light based on that. I would have done that from the beginning, but since I also have a couple of pull-down menus that also control different high-lighting, I thought I could possibly have done it in one fell swoop.
Thanks for your help anyway!
Irv

Hello,

You can set up sections specific highlighted timespan and it will override global one.

Kind regards,
Ilya