scheduler.xy.bar_height

I need to display 1) multi-line event in timeline view and 2) single-line event in multiday section of week/day views. scheduler.xy.bar_height would work for 1) but also increase the bar gaps in 2).

I really would like to remove the gaps in 2). Does anybody know what to do?

I’ve tried not setting scheduler.xy.bar_height and use something like this:

.dhx_cal_event_line {height:35px !important}
.dhx_multi_day .dhx_cal_event_line {height:20px !important}

It’ll display 2) in kind of the way I want… but display 1) in cascade style…

I’m not a front-end dev, please help… Thanks!




You can change scheduler.xy.bar_height dynamically

scheduler.attachEvent("onBeforeViewChange", function(a,b,mode){ if (mode == "timeline") scheduler.xy.bar_height = 60; else scheduler.xy.bar_height = 30; });

Thanks Stanislav. I just tried attaching the onBeforeViewChange event after calls to scheduler.init() and scheduler.parse() but it doesn’t seem to change the view anymore when I click on the button. Can you please take a look?

[code]

For demo purpose only :: &1
<script src='../../codebase/dhtmlxscheduler.js' type="text/javascript" charset="utf-8"></script>
<script src='../../codebase/ext/dhtmlxscheduler_timeline.js' type="text/javascript" charset="utf-8"></script>

<link rel='stylesheet' type='text/css' href='../../codebase/dhtmlxscheduler.css'>

<style type="text/css" media="screen">
	html, body{
		margin:0;
		padding:0;
		height:100%;
		overflow:hidden;
	}
	
</style>

<script type="text/javascript" charset="utf-8">
	function init() {

		scheduler.config.multi_day = true;
		scheduler.locale.labels.timeline_tab = "Timeline";
		scheduler.locale.labels.section_custom="Section";
		scheduler.config.details_on_create=true;
		scheduler.config.details_on_dblclick=true;
		scheduler.config.xml_date="%Y-%m-%d %H:%i";
	//	scheduler.xy.bar_height = "40";

		//===============
		//Configuration
		//===============
		var sections=[
			{key:1, label:"James Smith"},
			{key:2, label:"John Williams"},
			{key:3, label:"David Miller"},
			{key:4, label:"Linda Brown"}
		];

		scheduler.createTimelineView({
			name:	"timeline",
			x_unit:	"minute",
			x_date:	"%H:%i",
			x_step:	30,
			x_size: 24,
			x_start: 16,
			x_length:	48,
			y_unit:	sections,
			y_property:	"section_id",
			render:"bar"
		});

		//===============
		//Data loading
		//===============
		scheduler.config.lightbox.sections=[
			{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
			{name:"custom", height:23, type:"select", options:sections, map_to:"section_id" },
			{name:"time", height:72, type:"time", map_to:"auto"}
		];

		scheduler.init('scheduler_here',new Date(2009,5,30),"timeline");
		scheduler.parse([
			{ start_date: "2009-06-30 09:00", end_date: "2009-07-30 12:00", text:"Task A-12458", section_id:1},
			{ start_date: "2009-06-30 10:00", end_date: "2009-07-30 16:00", text:"Task A-89411", section_id:1},
			{ start_date: "2009-06-30 10:00", end_date: "2009-06-30 14:00", text:"Task A-64168", section_id:1},
			{ start_date: "2009-06-30 16:00", end_date: "2009-06-30 17:00", text:"Task A-46598", section_id:1},

			{ start_date: "2009-06-30 12:00", end_date: "2009-06-30 20:00", text:"Task B-48865", section_id:2},
			{ start_date: "2009-06-30 14:00", end_date: "2009-06-30 16:00", text:"Task B-44864", section_id:2},
			{ start_date: "2009-06-30 16:30", end_date: "2009-06-30 18:00", text:"Task B-46558", section_id:2},
			{ start_date: "2009-06-30 18:30", end_date: "2009-06-30 20:00", text:"Task B-45564", section_id:2},

			{ start_date: "2009-06-30 08:00", end_date: "2009-06-30 12:00", text:"Task C-32421", section_id:3},
			{ start_date: "2009-06-30 14:30", end_date: "2009-06-30 16:45", text:"Task C-14244", section_id:3},

			{ start_date: "2009-06-30 09:20", end_date: "2009-06-30 12:20", text:"Task D-52688", section_id:4},
			{ start_date: "2009-06-30 11:40", end_date: "2009-06-30 16:30", text:"Task D-46588", section_id:4},
			{ start_date: "2009-06-30 12:00", end_date: "2009-06-30 18:00", text:"Task D-12458", section_id:4}
		],"json");

//============ onBeforeViewChange for changing bar height
scheduler.attachEvent(“onBeforeViewChange”, function(a, b, mode){
// window.console && console.log(mode);
if (mode == “timeline”)
scheduler.xy.bar_height = 41;
else
scheduler.xy.bar_height = 30;
});
//=========================================================

	}
</script>
 
 
[/code]

Sorry, was a my mistake.
Code must look as

scheduler.attachEvent("onBeforeViewChange", function(a, b, mode){ if (mode == "timeline") scheduler.xy.bar_height = 41; else scheduler.xy.bar_height = 30; return true; });

Without “return true” at the end, scheduler blocks the default behavior.

1 Like

Got it. Thanks a lot!

hi
Any one tell how we can change my timeline view cells size

Check settings of timeline

docs.dhtmlx.com/doku.php?id=dhtm … melineview

You can specify dy - the minimal height of cells
As for width - it is auto-calculated based on screen’s width and length of time span.