Adding different marked timespan to different views

I am adding marked timespans to a view using the sections. When I load a different view, i have to load different marked timespans in different sections.
But the marked timespans from the first view still exist in the second view. For example, the column-1 has marked timespan in view-1, when you load the view-2 the marked timespan should be visible in column-4. But in the view-2 the marked timespan shows in column-1 and column-4.

How can this be fixed where the marked timespans from one view not show up in a different view? is there a way to remove all the marked timespans and add them again when a view is changed?

Why can’t you define sections property at marked timespan config. In this case you could define necessary sections for highlight.
See article:
docs.dhtmlx.com/scheduler/api__s … espan.html

For example:
docs.dhtmlx.com/scheduler/snippet/6c6f54d3

Thanks for the reply.

I added the timespan with the config properties.
scheduler.addMarkedTimespan({
start_date: dStart,
end_date: dEnd,
css: “BlockTime”,
type: “dhx_time_block”,
sections: { timeline:“4”, unit:“4”}
});

The unique part about the timespans is that i have a marked timespan from 2am -9am for all the sections and timelines, then another timespan of 2 hours 10am -12pm for some units/timelines.
For example: I have 4 units in a view, I have a timespan 2-9 for 4 units and a timespan 10-12 for 1st unit. The next view has 2 units and each of the unit needs to have only 2-9 timespan.

Initially, when you load view-1 everything is displayed correctly but when you load the view-2. the timespan 10-12 is displayed in the 1st unit but I am not calling addMarkedTimespan for this time period. This unexpected timespan persists when load other views. Is there a way to fix this issue where the timespan don’t persist?

Do you mean, that special timespan for 1st unit shows instead of another timespans.
Currently it’s how it works. If there is no special timespans for unit common one will be used. If there is special timespan for units it will be shown instead.
Possibly you could explicity define sections property if you want to show timespan for all the units.
docs.dhtmlx.com/scheduler/snippet/52668be0
If you still have problems, could you provide your sample?

Hi,
I tried the code snippet attached in the previous post but the timespans persist in different views. The following is my code sample.
I want the timespans to be shows correctly in different views, there could be exceptions added by anyone they all should be shows correctly.
For example, in the resource view an exception is added for all the sections between 2 am - 9 am, and an exception for section-4 between 10 am - 12 pm, I want all the sections to show the common timespan and section-4 to show 10 am -12 pm timespan for March 24. When i load the resource view for tomorrow, it should only show the timespans for tomorrow and not display the ones from today. My problem is when I load March 24 for the first time, the timespans are shown correctly but when I load March 25 which has no timespans, all the timespans from March 24 are showing in March 25. I need to prevent this from happening since I pass in the list of exception every time a new view is loaded. Could you please point me to a way where i could remove the timespans from the previous views and load them again correctly for the current view?

I pass in an array that has details of the timespans
["{ start_date:“2016,2,24,0,0,0,0”, end_date:“2016,2,24,0,1,0,0”, color:“green”, section_id:1, excepid:“9F1E1509-3D1A-4ACE-946F-19DAEE23B5F3”}","{ start_date:“2016,2,24,23,59,0,0”, end_date:“2016,2,25,0,0,0,0”, color:“green”, section_id:1, excepid:“2F38FDE1-46D4-44F7-892C-72FFD35D0DAC”}"]

function refreshExceptions(excep, refreshScreen){
if(excep && excep.length > 0){
var sBlockTime;

	for (var i=0; i < excep.length; i++){
		var aStart = excep[i].start_date.split(",");
		var dStart = new Date();
		dStart.setFullYear(aStart[0],aStart[1],aStart[2]);
		dStart.setHours(aStart[3]);
		dStart.setMinutes(aStart[4],aStart[5],0);
		
		var aEnd = excep[i].end_date.split(",");
		var dEnd = new Date();
		dEnd.setFullYear(aEnd[0],aEnd[1],aEnd[2]);
		dEnd.setHours(aEnd[3]);
		dEnd.setMinutes(aEnd[4],aEnd[5],0);
		
		var id = excep[i].section_id;
		
		sBlockTime = { 
			start_date: dStart,
			end_date: dEnd,
			css:   "BlockTime",
			type:  "dhx_time_block", 
			sections: { timeline:id, unit:id} 
		}
		if (sBlockTime){
			scheduler.addMarkedTimespan(sBlockTime);
		}
	}
	
	 if(refreshScreen){
		scheduler.updateView(_DisplayDate, _mode);	
	}
}

}