Remove the event start and event end times from event boxes

I am using the scheduler and I need to get sometimes 50 events on one day and then have my users be able to drag and drop them where they want to. The problem is the event boxes are too big, too tall. I can only get 15-20 events on one day.

So I need to remove the event start time and event end time form the event box.

I just want to show the event name. I need this for all views.

For example here are example event boxes that I have currently

08:30- 09:45
Go to School

10:15-11:15
Walk the dog

I need the event boxes to display like this (WITHOUT THE TIMES SHOWING)

Go to School
Walk the Dog

How do I do this? I have looked all over the DHTMLX site?

Check
samples\02_customization\27_custom_event_box.html

Where is this page?

samples\02_customization\27_custom_event_box.html

Its very very very difficult to get even the simplest question answered for the scheduler

How do I remove the start time and end time from event boxes??

it’s included in the download of dhtmlxScheduler v.3.7. After extracting the zip file you should find a samples folder. Open the HTML sample page that stanislav suggested and by reading the source code you can have an idea on how to achieve that functionality.

There’s also some documentation here:

http://docs.dhtmlx.com/doku.php?id=dhtmlxscheduler:sizing

and here:

http://docs.dhtmlx.com/doku.php?id=dhtmlxscheduler:custom_events_display

I’ve playing around with that example and I think is working as you wanted now. Maybe you’ll have to make some adjustements to the css if you use other skins. It’s also possible to separate some css. Please note that the html tags have been stripped at the time of posting. Also keep in mind that "scheduler.xy.min_event_height = 14; " using the unit scale height of the sample sets the minimum duration of the event in 15 minutes. If I set a lower value the text of the event is cutted, so the solution is to increase the scale unit height.

[code]

dhtmlxScheduler: Custom event box
<script src="../../codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="../../codebase/dhtmlxscheduler.css" type="text/css" media="screen" title="no title"
      charset="utf-8">

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

</style>

<script type="text/javascript" charset="utf-8">
	function init() {
		scheduler.config.multi_day = false;
		scheduler.config.xml_date = "%Y-%m-%d %H:%i";
		scheduler.config.first_hour = 4;

		scheduler.config.details_on_create = true;
		scheduler.config.details_on_dblclick = true;
		scheduler.config.icons_select = ["icon_details","icon_delete"];

	    scheduler.xy.min_event_height = 14; 

		scheduler.renderEvent = function(container, ev) {
		    var container_width = container.style.width; // e.g. "105px"
		    var container_height = container.style.height;

			// move section
		    var html = "<div class='dhx_event_move dhx_header' style='width: " + (parseFloat(container_width) - 2) + 'px' + ";'></div>";

			// container for event contents
		    html += "<div class='dhx_event_move dhx_body' style='cursor:pointer;padding-top:0px;padding-bottom:0px;height: " + container_height + ";width: " + (parseFloat(container_width) - 10) + 'px' + "'>";

			// displaying event text
		    html += scheduler.templates.event_text(ev.start_date, ev.end_date, ev) + "</div>";

			// resize section
			html += "<div class='dhx_event_resize dhx_footer' style='width: " + (parseFloat(container_width) - 4) + 'px' + ";'></div>";

			container.innerHTML = html;
			return true; // required, true - we've created custom form; false - display default one instead
		};

		scheduler.init('scheduler_here', new Date(2010, 0, 10), "week");

		scheduler.addEvent({
			start_date: new Date(2010,0,7,13,0),
			end_date: new Date(2010,0,7,13,30),
			text: "30 minutes fit"
		});
		scheduler.addEvent({
			start_date: new Date(2010,0,7,15,0),
			end_date: new Date(2010,0,7,15,45),
			text: "45 minutes"
		});
		scheduler.addEvent({
			start_date: new Date(2010,0,8,9,30),
			end_date: new Date(2010,0,8,11,30),
			text: "2 hours"
		});
	}
</script>
 
 
[/code]

btw, I think that the support of the forum is great. Everybody gets a response in less than a business day. I’m using the free version and all my questions have been replied or at least they gave an idea on how to solve the problem.

Good luck!

mdp…thank you. Your suggestion worked!! It does remove the start& end times as I wanted.

However for those views that use your code the event color is not changing as it was.

I think the styles here in the code are overwriting the styles from my database.

// container for event contents
html += “<div class=‘dhx_event_move dhx_body’ style=‘cursor:pointer;padding-top:0px;padding-bottom:0px;height: " + container_height + ";width: " + (parseFloat(container_width) - 10) + ‘px’ + "’>”;

Any suggestions on how to fix it back so that it will change the event color based like it was before ?

Thank you again for your help

That’s correct.
The example is using the default colours.
If you are using a different css class to style the events (a different background color, font, etc) Then you’ll have to replace the default class with your own class. In fact, you can use any class to style the events as you want.

Right now, each event is rendered as follows:

<div style="position: absolute; top: 378px; left: 26px; width: 143px; height: 21px;" class="dhx_cal_event" event_id="13"> <div style="width: 141px;" class="dhx_event_move dhx_header"></div> <div style="cursor: pointer; padding-top: 0px; padding-bottom: 0px; height: 21px; width: 133px" class="dhx_event_move dhx_body">30 minutes fit</div> <div style="width: 139px;" class="dhx_event_resize dhx_footer"></div> </div>

if you want to target the whole event then you can use

scheduler.templates.event_class = function (start, end, event) { return "my_css_class"; };
The previous code will add “my_css_class” to the div that already has “dhx_cal_event” class.

if you want just to change the body of the event then replace dhx_body with your css class (the same happen with remove & resize section).
Please note that you can also remove the resize & move section if you don’t need them. I just leave them there to get the same look of the example (It’s the same with the width adjustements)