Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by mahesh on Oct 21, 2009 01:22
open dhtmlx forum
dhtmlx scheduler

Another question. Under the description field, how can I enter a multiline text reminder? A CR closes the window for entering data.
Answer posted by Stanislav (support) on Oct 21, 2009 01:32
You can alter the render method as

scheduler.form_blocks.textarea.render=function(sns){
    var height=(sns.height||"130")+"px";
    var html="<div class='dhx_cal_ltext' style='height:"+height+";'><textarea></textarea></div>";
    if (sns.reminder) html+="<div>"+sns.reminder+"</div>";
    return html;
}

and form config as 


scheduler.config.lightbox.sections=[
   {  name:"description", height:200, map_to:"text", type:"textarea" , focus:true, reminder:"any text here"},
   { name:"time", height:72, type:"time", map_to:"auto"}  
]
Answer posted by mahesh on Nov 24, 2009 23:09
I tried this, it does not seem to work.
Answer posted by Alex (support) on Nov 25, 2009 06:22

Locally the sample approach works: "any text here" line always appears at the end of the description field. 

Answer posted by mahesh on Nov 25, 2009 18:02
Yes, I did notice that, and thought is was kind of nice, but I guess there was a mis-communication:   I was interested in entering the actual contents in multiple lines, with shift-CR not preserving the formatting for the actual description entry.
Answer posted by Alex (support) on Nov 26, 2009 07:50

You can define custom event_text template:

scheduler.templates.event_text=function(start,end,event){
  return "<pre>"+event.text+"</pre>";
}

Answer posted by mahesh on Nov 26, 2009 10:56

Stilll does not seem to preserve the CR/LF construct for an entry for the description field.   Any way to do this?

Also, is there a way to word wrap this field on the month view? 

Answer posted by Alex (support) on Nov 27, 2009 03:29

>> Stilll does not seem to preserve the CR/LF construct for an entry for the description field. Any way to do this?

do you mean the description field in the lightbox ? Locally its formatting is preserved. 

Please, send us the screenshot that demonstrates the issue.

>> Also, is there a way to word wrap this field on the month view? 

It is possible to increase the height of event line in the month view. For example each event can occupy 2 lines instead of 1 even width of the event text requires only one line.

This is the only possible solution. If you are interested in it, we can provide it.

Answer posted by mahesh on Nov 27, 2009 14:18

I think I finally understand.  The custom even_text  method works once you click on the day view, but not on the month view in the calendar preserving the CR/LF format in the day view with SHIFT/CR.  So on the lightbox it looks ok.  So, I will incorporate your suggestion of:

scheduler.templates.event_text=function(start,end,event){
  return "<pre>"+event.text+"</pre>";
}

If you have a method of allowing two or three lines for a single event on a month view of the calendar that would probably solve the problem, so folks can see an event that has more text data.

Answer posted by Alex (support) on Nov 30, 2009 04:23

You can try to define the following css class on the page to display events in month view in 2 lines:

.dhx_cal_event_clear{
  height:26px;
  white-space:normal;
}

This class should be included after dhtmlxscheduler.css



Answer posted by mahesh on Dec 01, 2009 11:14
does not seem to work.  The calendar fails to render.
Answer posted by Alex (support) on Dec 02, 2009 01:26
Please, provide the sample to recreate the issue
Answer posted by mahesh on Dec 02, 2009 09:40

I did get it to work using:

<link rel="stylesheet" href="codebase/dhtmlxscheduler.css" type="text/css" title="Conference schedule"
charset="utf-8">

<style type=text/css>
       .dhx_cal_event_clear{
  height:26px;
  white-space:normal;
}
</style>

But now if there are multiple events, or I try to increase height to 39 pixels to get 3 lines, the next event in the day text tends to overlap with the preceeding text.

Answer posted by Alex (support) on Dec 03, 2009 02:44

It is necessary to change also the following property:

scheduler.xy.bar_height = 39px;

Answer posted by mahesh on Dec 03, 2009 08:41
adding this change to the scheduler config variable section results in a failure to render the calendar.  any thoughts?
Answer posted by Alex (support) on Dec 03, 2009 08:59

there was a typo in the previous answer.

There should be scheduler.xy.bar_height = 39; instead of scheduler.xy.bar_height = 39px;

Answer posted by mahesh on Dec 03, 2009 14:28
thanks, that works!